|
|||||||||
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 changing 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(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. |
|
|
toArray(T[] a)
|
|
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 Collection<E>
size
in class 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 List<E> objectsList()
Index
List
of indexed objects, in the order of their indices.
objectsList
in interface Index<E>
List
of indexed objectspublic Collection<E> objects(int[] indices)
Index
Collection
.
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()
Index
Index.add(E)
will
leave the Index unchanged and return false
).
lock
in interface Index<E>
public void unlock()
Index
Index.add(E)
will
leave the Index unchanged and return false
).
unlock
in interface Index<E>
public void saveToWriter(Writer out)
Index
saveToWriter
in interface Index<E>
out
- Writer to save to.public void saveToFilename(String s)
Index
saveToFilename
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>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |