public class DeltaIndex<E> extends java.util.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(java.util.Collection<? extends E> c) |
int |
addToIndex(E o)
Takes an Object and returns the integer index of the Object.
|
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(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)
Deprecated.
|
boolean |
isEmpty() |
boolean |
isLocked()
Queries the Index for whether it's locked or not.
|
java.util.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.
|
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.
|
java.lang.String |
toString()
super ghetto
|
void |
unlock()
Unlocks the Index.
|
containsAll, remove, removeAll, retainAll, toArray, toArray
public int size()
Index
public E get(int i)
Index
public int indexOf(E o)
Index
public int addToIndex(E o)
Index
addToIndex
in interface Index<E>
o
- the Object whose index is desired.@Deprecated public int indexOf(E o, boolean add)
Index
public java.util.List<E> objectsList()
Index
List
of indexed objects, in the order of their indices.objectsList
in interface Index<E>
List
of indexed objectspublic java.util.Collection<E> objects(int[] indices)
Index
Collection
.public boolean isLocked()
Index
public void lock()
Index
Index.add(E)
will
leave the Index unchanged and return false
).public void unlock()
Index
Index.add(E)
will
leave the Index unchanged and return false
).public void saveToWriter(java.io.Writer out)
Index
saveToWriter
in interface Index<E>
out
- Writer to save to.public void saveToFilename(java.lang.String s)
Index
saveToFilename
in interface Index<E>
s
- File name.public boolean contains(java.lang.Object o)
public boolean add(E e)
public boolean addAll(java.util.Collection<? extends E> c)
public void clear()
public boolean isEmpty()
public java.util.Iterator<E> iterator()
public java.lang.String toString()
toString
in class java.util.AbstractCollection<E>