|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
edu.stanford.nlp.util.DeltaIndex<E>
public class DeltaIndex<E>
A class that has a backing index, such as a hash index you don't
want changed, and another index which will hold extra entries that
get added during the life of the index.
It is important that nothing else changes the backing index while
a DeltaIndex is in use. The behavior of this index is
undefined if the backing index changes, although in general the new
entries in the backing index will be ignored.
| Constructor Summary | |
|---|---|
DeltaIndex(Index<E> backingIndex)
|
|
DeltaIndex(Index<E> backingIndex,
Index<E> spilloverIndex)
|
|
| Method Summary | ||
|---|---|---|
boolean |
add(E e)
|
|
boolean |
addAll(java.util.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(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 |
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. |
|
|
toArray(T[] a)
|
|
java.lang.String |
toString()
super ghetto |
|
void |
unlock()
Unlocks the Index. |
|
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, remove, removeAll, retainAll, toArray |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public DeltaIndex(Index<E> backingIndex)
public DeltaIndex(Index<E> backingIndex,
Index<E> spilloverIndex)
| Method Detail |
|---|
public int size()
Index
size in interface Index<E>size in interface java.util.Collection<E>size in class java.util.AbstractCollection<E>public E get(int i)
Index
get in interface Index<E>i - the integer index to be queried for the corresponding argument
public int indexOf(E o)
Index
indexOf in interface Index<E>o - The Object whose index is desired.
public int indexOf(E o,
boolean add)
Index
indexOf in interface Index<E>o - the Object whose index is desired.add - Whether it is okay to add new items to the index
public java.util.List<E> objectsList()
IndexList 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)
IndexCollection.
objects in interface Index<E>indices - An array of indices
Collection of the objects corresponding to the indices argument.public boolean isLocked()
Index
isLocked in interface Index<E>public void lock()
IndexIndex.add(E) will
leave the Index unchanged and return false).
lock in interface Index<E>public void unlock()
IndexIndex.add(E) will
leave the Index unchanged and return false).
unlock in interface Index<E>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)
contains in interface Index<E>contains in interface java.util.Collection<E>contains in class java.util.AbstractCollection<E>public <T> T[] toArray(T[] a)
toArray in interface Index<E>toArray in interface java.util.Collection<E>toArray in class java.util.AbstractCollection<E>public boolean add(E e)
add in interface Index<E>add in interface java.util.Collection<E>add in class java.util.AbstractCollection<E>public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface Index<E>addAll in interface java.util.Collection<E>addAll in class java.util.AbstractCollection<E>public void clear()
clear in interface Index<E>clear in interface java.util.Collection<E>clear in class java.util.AbstractCollection<E>public boolean isEmpty()
isEmpty in interface java.util.Collection<E>isEmpty in class java.util.AbstractCollection<E>public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in interface java.util.Collection<E>iterator in class java.util.AbstractCollection<E>public java.lang.String toString()
toString in class java.util.AbstractCollection<E>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||