Package org.apache.uima.internal.util
Class CopyOnWriteObjHashSet<T extends FeatureStructure>
- java.lang.Object
-
- org.apache.uima.internal.util.CopyOnWriteObjHashSet<T>
-
- All Implemented Interfaces:
CopyOnWriteIndexPart<T>
public class CopyOnWriteObjHashSet<T extends FeatureStructure> extends java.lang.Object implements CopyOnWriteIndexPart<T>
implements ObjHashSet partially, for iterator use
-
-
Field Summary
Fields Modifier and Type Field Description private ObjHashSet<T>ohsprivate ObjHashSet<T>originalprivate intoriginal_size
-
Constructor Summary
Constructors Constructor Description CopyOnWriteObjHashSet(ObjHashSet<T> original)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcopyToArray(T[] target, int startingIndexInTarget)Copy FS refs to target from this index partintfind(T obj)Tget(int index)For iterator useintgetCapacity()booleanisOriginal()java.util.Iterator<T>iterator()voidmakeReadOnlyCopy()Called by index when about to make an updateintmoveTo(FeatureStructure fs)if the fs is in the set, the iterator should return it.intmoveToNextFilled(int pos)advance pos until it points to a non 0 or is 1 past endintmoveToPreviousFilled(int pos)decrement pos until it points to a non 0 or is -1intsize()java.lang.StringtoString()
-
-
-
Field Detail
-
ohs
private ObjHashSet<T extends FeatureStructure> ohs
-
original
private ObjHashSet<T extends FeatureStructure> original
-
original_size
private final int original_size
-
-
Constructor Detail
-
CopyOnWriteObjHashSet
public CopyOnWriteObjHashSet(ObjHashSet<T> original)
-
-
Method Detail
-
makeReadOnlyCopy
public void makeReadOnlyCopy()
Called by index when about to make an update- Specified by:
makeReadOnlyCopyin interfaceCopyOnWriteIndexPart<T extends FeatureStructure>
-
find
public int find(T obj)
- Parameters:
obj- the object to find in the table (if it is there)- Returns:
- the position of obj in the table, or -1 if not in the table
-
get
public T get(int index)
For iterator use- Parameters:
index- a magic number returned by the internal find- Returns:
- the T at that spot, or null if nothing there
-
moveToNextFilled
public int moveToNextFilled(int pos)
advance pos until it points to a non 0 or is 1 past end- Parameters:
pos- -- Returns:
- updated pos
-
moveToPreviousFilled
public int moveToPreviousFilled(int pos)
decrement pos until it points to a non 0 or is -1- Parameters:
pos- -- Returns:
- updated pos
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iteratorin interfaceCopyOnWriteIndexPart<T extends FeatureStructure>- Returns:
- iterator over all the elements
-
moveTo
public int moveTo(FeatureStructure fs)
if the fs is in the set, the iterator should return it. if not, return -1 (makes iterator invalid)- Parameters:
fs- position to this fs- Returns:
- the index if present, otherwise -1;
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getCapacity
public int getCapacity()
- Returns:
- the capacity >= size
- See Also:
Common_hash_support.getCapacity()
-
size
public final int size()
- Specified by:
sizein interfaceCopyOnWriteIndexPart<T extends FeatureStructure>- Returns:
- the size
- See Also:
Common_hash_support.size()
-
isOriginal
public boolean isOriginal()
- Specified by:
isOriginalin interfaceCopyOnWriteIndexPart<T extends FeatureStructure>- Returns:
- true if this cow version is the same as the original. true means the index has not been updated
-
copyToArray
public int copyToArray(T[] target, int startingIndexInTarget)
Description copied from interface:CopyOnWriteIndexPartCopy FS refs to target from this index part- Specified by:
copyToArrayin interfaceCopyOnWriteIndexPart<T extends FeatureStructure>- Parameters:
target- the target array to copy intostartingIndexInTarget- the starting index in the target array- Returns:
- startingIndexInTarget + size
-
-