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 Object
implements CopyOnWriteIndexPart<T>
implements ObjHashSet partially, for iterator use
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
copyToArray
(T[] target, int startingIndexInTarget) Copy FS refs to target from this index partint
get
(int index) For iterator useint
boolean
iterator()
void
Called by index when about to make an updateint
if the fs is in the set, the iterator should return it. if not, return -1 (makes iterator invalid)int
moveToNextFilled
(int pos) advance pos until it points to a non 0 or is 1 past endint
moveToPreviousFilled
(int pos) decrement pos until it points to a non 0 or is -1final int
size()
toString()
-
Constructor Details
-
CopyOnWriteObjHashSet
-
-
Method Details
-
makeReadOnlyCopy
public void makeReadOnlyCopy()Called by index when about to make an update- Specified by:
makeReadOnlyCopy
in interfaceCopyOnWriteIndexPart<T extends FeatureStructure>
-
find
- 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
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
- Specified by:
iterator
in interfaceCopyOnWriteIndexPart<T extends FeatureStructure>
- Returns:
- iterator over all the elements
-
moveTo
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
-
getCapacity
public int getCapacity()- Returns:
- the capacity >= size
- See Also:
-
size
public final int size()- Specified by:
size
in interfaceCopyOnWriteIndexPart<T extends FeatureStructure>
- Returns:
- the size
- See Also:
-
isOriginal
public boolean isOriginal()- Specified by:
isOriginal
in 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
Description copied from interface:CopyOnWriteIndexPart
Copy FS refs to target from this index part- Specified by:
copyToArray
in interfaceCopyOnWriteIndexPart<T extends FeatureStructure>
- Parameters:
target
- the target array to copy intostartingIndexInTarget
- the starting index in the target array- Returns:
- startingIndexInTarget + size
-