1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.morph.wrap;
17
18
19 /**
20 * A wrapper for 'container-like' structures that have a logical ordering which
21 * can be used to retrieve elements at a specific index within the structure.
22 * Lists, SortedSets, and arrays are good examples of indexed structures. Note
23 * that some indexed structures will have O(1) methods for retrieving objects at
24 * a given index (ArrayList, TreeSet, array) and others will have O(n) methods
25 * for retrieving objects at a given index (LinkedList).
26 *
27 * @author Matt Sgarlata
28 * @since Jan 16, 2005
29 */
30 public interface IndexedContainer extends Container, Sizable {
31
32 /**
33 * Gets the element at the specified index. Valid indexes range between 0
34 * and one less than the container object's size, inclusive.
35 *
36 * @param index
37 * a number indiciating which element should be retrieved
38 * @return the object at the specified index
39 * @throws WrapperException
40 * if <code>index</code> is not a valid index for this
41 * container object or <br>
42 * the object at the specified index could not be retrieved for
43 * some reason
44 */
45 public Object get(Object container, int index) throws WrapperException;
46
47 }