public class DeltaIndex<E> extends AbstractCollection<E> implements Index<E>
| Constructor and Description |
|---|
DeltaIndex(Index<E> backingIndex) |
DeltaIndex(Index<E> backingIndex,
Index<E> spilloverIndex) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
boolean |
addAll(Collection<? extends E> c) |
void |
clear()
We don't want to change the backing index in any way, and "clear"
would have to entail doing that, so we just throw an
UnsupportedOperationException instead
|
boolean |
contains(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 |
isEmpty() |
boolean |
isLocked()
Queries the Index for whether it's locked or not.
|
Iterator<E> |
iterator()
This is one instance where elements added to the backing index
will show up in this index's operations
|
void |
lock()
Locks the Index.
|
Collection<E> |
objects(int[] indices)
Looks up the objects corresponding to an array of indices, and returns them in a
Collection. |
List<E> |
objectsList()
Returns a complete
List of indexed objects, in the order of their indices. |
void |
saveToFilename(String s)
Save the contents of this index into a file.
|
void |
saveToWriter(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.
|
<T> T[] |
toArray(T[] a) |
String |
toString()
super ghetto
|
void |
unlock()
Unlocks the Index.
|
containsAll, remove, removeAll, retainAll, toArrayclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCodepublic int size()
Indexsize in interface Index<E>size in interface Collection<E>size in class AbstractCollection<E>public E get(int i)
Indexpublic int indexOf(E o)
Indexpublic int indexOf(E o, boolean add)
Indexpublic List<E> objectsList()
IndexList of indexed objects, in the order of their indices.objectsList in interface Index<E>List of indexed objectspublic Collection<E> objects(int[] indices)
IndexCollection.objects in interface Index<E>indices - An array of indicesCollection of the objects corresponding to the indices argument.public boolean isLocked()
Indexpublic void lock()
IndexIndex.add(E) will
leave the Index unchanged and return false).public void unlock()
IndexIndex.add(E) will
leave the Index unchanged and return false).public void saveToWriter(Writer out)
IndexsaveToWriter in interface Index<E>out - Writer to save to.public void saveToFilename(String s)
IndexsaveToFilename in interface Index<E>s - File name.public boolean contains(Object o)
contains in interface Index<E>contains in interface Collection<E>contains in class AbstractCollection<E>public <T> T[] toArray(T[] a)
toArray in interface Index<E>toArray in interface Collection<E>toArray in class AbstractCollection<E>public boolean add(E e)
add in interface Index<E>add in interface Collection<E>add in class AbstractCollection<E>public boolean addAll(Collection<? extends E> c)
addAll in interface Index<E>addAll in interface Collection<E>addAll in class AbstractCollection<E>public void clear()
clear in interface Index<E>clear in interface Collection<E>clear in class AbstractCollection<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in class AbstractCollection<E>public Iterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in class AbstractCollection<E>public String toString()
toString in class AbstractCollection<E>