|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
E
- The type of objects in the Indexpublic interface Index<E>
Minimalist interface for implementations of Index. This interface should allow HashIndex and OAIndex to be used interchangeably in certain contexts. Originally extracted from util.Index on 3/13/2007.
Method Summary | ||
---|---|---|
boolean |
add(E e)
|
|
boolean |
addAll(java.util.Collection<? extends E> c)
|
|
void |
clear()
|
|
boolean |
contains(java.lang.Object o)
|
|
E |
get(int i)
Gets the object whose index is the integer argument. |
|
int |
indexOf(E o)
Returns the integer index of the Object in the Index or -1 if the Object is not already in the Index. |
|
int |
indexOf(E o,
boolean add)
Takes an Object and returns the integer index of the Object, perhaps adding it to the index first. |
|
boolean |
isLocked()
Queries the Index for whether it's locked or not. |
|
void |
lock()
Locks the Index. |
|
java.util.Collection<E> |
objects(int[] indices)
Looks up the objects corresponding to an array of indices, and returns them in a Collection . |
|
java.util.List<E> |
objectsList()
Returns a complete List of indexed objects, in the order of their indices. |
|
void |
saveToFilename(java.lang.String s)
Save the contents of this index into a file. |
|
void |
saveToWriter(java.io.Writer out)
Save the contents of this index into string form, as part of a larger text-serialization. |
|
int |
size()
Returns the number of indexed objects. |
|
|
toArray(T[] a)
|
|
void |
unlock()
Unlocks the Index. |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
int size()
E get(int i)
i
- the integer index to be queried for the corresponding argument
int indexOf(E o)
o
- the Object whose index is desired.
int indexOf(E o, boolean add)
o
- the Object whose index is desired.add
- Whether it is okay to add new items to the index
java.util.List<E> objectsList()
List
of indexed objects, in the order of their indices.
List
of indexed objectsjava.util.Collection<E> objects(int[] indices)
Collection
.
indices
- An array of indices
Collection
of the objects corresponding to the indices argument.boolean isLocked()
void lock()
add(E)
will
leave the Index unchanged and return false
).
void unlock()
add(E)
will
leave the Index unchanged and return false
).
void saveToWriter(java.io.Writer out) throws java.io.IOException
out
- Writer to save to.
java.io.IOException
- Exception thrown if cannot save.void saveToFilename(java.lang.String s)
s
- File name.boolean contains(java.lang.Object o)
<T> T[] toArray(T[] a)
boolean add(E e)
boolean addAll(java.util.Collection<? extends E> c)
void clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |