Package org.apache.uima.cas.impl
Class FSIntArrayIndex<T extends FeatureStructure>
java.lang.Object
org.apache.uima.cas.impl.FSLeafIndexImpl<T>
org.apache.uima.cas.impl.FSIntArrayIndex<T>
- Type Parameters:
T
- the Java cover class type for this index, passed along to (wrapped) iterators producing Java cover classes
- All Implemented Interfaces:
Comparator<T>
,FSIndexImpl
,LowLevelIndex
,IntComparator
Used for sorted indexes only
Uses IntVector (sorted) as the index (of FSs)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IntComparator
private final IntVector
private final int
private final boolean
Fields inherited from class org.apache.uima.cas.impl.FSLeafIndexImpl
lowLevelCAS
-
Constructor Summary
ConstructorsConstructorDescriptionFSIntArrayIndex
(CASImpl cas, Type type, int initialSize, int indexType, boolean isAnnotationIndex) -
Method Summary
Modifier and TypeMethodDescriptionprivate final int
binarySearch
(int[] array, int ele, int start, int end) protected void
For serialization: get all the items in this index and bulk add to an IntVectorint
compare
(int fs1, int fs2) Note: may return other than -1 , 0, and 1 (e.g., might return -6)boolean
void
Method deleteFS.private final int
find
(int fsRef) In a sorted array of fsAddrs, find one (perhaps out of many) that matches the keys in fsRef, or if none match, return a negative number of insertion point if not foundfind
(FeatureStructure fs) (package private) final int
findEq
(int fsRef) Like find, but if found, returns position of Exact FS spot or neg of an insert spot (if no == match)(package private) final int
findLeftmost
(int fsRef) In a sorted array of fsAddrs, find the lowest one that matches the keys in fsRef, or if none match, return a negative number of insertion point if not foundvoid
flush()
(package private) IntVector
(package private) boolean
init
(FSIndexComparator comp) final boolean
insert
(int fs) (package private) final boolean
insert
(int fs, int count) boolean
ll_containsEq
(int fsAddr) Get a low-level, FS reference iterator.pointerIterator
(IntComparator comp, int[] detectIllegalIndexUpdates, int typeCode) The comp value is only used when ordering iterators in type/subtype collectionsprivate final int
refineToExactFsSearch
(int fsRef, int startingPos) protected IntPointerIterator
protected IntPointerIterator
refIterator
(int fsAddr) boolean
remove
(int fsRef) int
size()
Get the number of FSs in this index.Methods inherited from class org.apache.uima.cas.impl.FSLeafIndexImpl
compare, equals, getComparator, getIndexingStrategy, getIntComparator, getIntIterator, getType, getTypeCode, hashCode, iterator, ll_compare, ll_iterator, ll_rootIterator, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
indexIntVector
-
initialSize
private final int initialSize -
isAnnotationIndex
private final boolean isAnnotationIndex -
annotationIntComparator
-
-
Constructor Details
-
FSIntArrayIndex
-
-
Method Details
-
init
- Overrides:
init
in classFSLeafIndexImpl<T extends FeatureStructure>
- See Also:
-
getVector
IntVector getVector() -
flush
public void flush() -
insert
public final boolean insert(int fs) - Specified by:
insert
in classFSLeafIndexImpl<T extends FeatureStructure>
-
insert
final boolean insert(int fs, int count) - Specified by:
insert
in classFSLeafIndexImpl<T extends FeatureStructure>
-
find
private final int find(int fsRef) In a sorted array of fsAddrs, find one (perhaps out of many) that matches the keys in fsRef, or if none match, return a negative number of insertion point if not found- Parameters:
fsRef
-- Returns:
- index of an arbitrary FS that matches on the compare function or a negative number of insertion point if not found
-
findLeftmost
final int findLeftmost(int fsRef) In a sorted array of fsAddrs, find the lowest one that matches the keys in fsRef, or if none match, return a negative number of insertion point if not found- Parameters:
fsRef
-- Returns:
- index of the left-most FS for this particular type that matches on the compare function or a negative number of insertion point if not found
-
findEq
final int findEq(int fsRef) Like find, but if found, returns position of Exact FS spot or neg of an insert spot (if no == match)- Parameters:
fsRef
-- Returns:
- position of Exact FS spot or neg of an insert spot (if no == match)
-
binarySearch
private final int binarySearch(int[] array, int ele, int start, int end) -
refineToExactFsSearch
private final int refineToExactFsSearch(int fsRef, int startingPos) -
pointerIterator
public ComparableIntPointerIterator<T> pointerIterator(IntComparator comp, int[] detectIllegalIndexUpdates, int typeCode) The comp value is only used when ordering iterators in type/subtype collections- Specified by:
pointerIterator
in classFSLeafIndexImpl<T extends FeatureStructure>
-
refIterator
- Specified by:
refIterator
in classFSLeafIndexImpl<T extends FeatureStructure>
- See Also:
-
ll_iterator
Description copied from interface:LowLevelIndex
Get a low-level, FS reference iterator.- Returns:
- An iterator for this index.
-
refIterator
- Specified by:
refIterator
in classFSLeafIndexImpl<T extends FeatureStructure>
- See Also:
-
contains
- Parameters:
fs
- the feature structure- Returns:
- true if the fs is contained
- See Also:
-
ll_containsEq
public boolean ll_containsEq(int fsAddr) -
find
-
size
public int size()Description copied from interface:LowLevelIndex
Get the number of FSs in this index.- Returns:
- The size of this index.
- See Also:
-
deleteFS
Description copied from class:FSLeafIndexImpl
Method deleteFS.- Specified by:
deleteFS
in classFSLeafIndexImpl<T extends FeatureStructure>
- Parameters:
fs
- -- See Also:
-
remove
public boolean remove(int fsRef) - Specified by:
remove
in classFSLeafIndexImpl<T extends FeatureStructure>
- Parameters:
fsRef
- - the Feature Structure to be removed. Only this exact Feature Structure is removed (this is a stronger test than, for example, what moveTo(fs) does, where the fs in that case is used as a template). It is not an error if this exact Feature Structure is not in an index.- Returns:
- true if something was removed, false if not found
-
bulkAddTo
Description copied from class:FSLeafIndexImpl
For serialization: get all the items in this index and bulk add to an IntVector- Specified by:
bulkAddTo
in classFSLeafIndexImpl<T extends FeatureStructure>
- Parameters:
v
- the set of items to add
-
compare
public int compare(int fs1, int fs2) Description copied from class:FSLeafIndexImpl
Note: may return other than -1 , 0, and 1 (e.g., might return -6)- Specified by:
compare
in interfaceIntComparator
- Overrides:
compare
in classFSLeafIndexImpl<T extends FeatureStructure>
- Parameters:
fs1
- -fs2
- -- Returns:
- 0 if equal, < 0 if fs1 < fs2, > 0 if fs1 > fs2
-