Package org.apache.uima.cas.impl
Class FSBagIndex<T extends FeatureStructure>
java.lang.Object
org.apache.uima.cas.impl.FSLeafIndexImpl<T>
org.apache.uima.cas.impl.FSBagIndex<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 UIMA FS Bag Indexes
Uses IntVector or PositiveIntSet to hold values of FSs
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IntVector
private final PositiveIntSet
private int
(package private) static final boolean
Fields inherited from class org.apache.uima.cas.impl.FSLeafIndexImpl
lowLevelCAS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
For serialization: get all the items in this index and bulk add to an IntVectorint
compare
(int fs1, int fs2) For bag indexes, compare equal only if identical addressesboolean
void
Method deleteFS.private int
find
(int ele) find
(FeatureStructure fs) (package private) int
findLeftmost
(int ele) Left most in case there are multiple instances of the same item This only works if not use Positive Int Set because that's the only time there are multiple instances of the same (meaning having the same heap address) itemvoid
flush()
(package private) int
get
(int itPos) int
hashCode()
(package private) boolean
init
(FSIndexComparator comp) final boolean
insert
(int fs) (package private) boolean
insert
(int fs, int count) (package private) boolean
isValid
(int itPos) (package private) boolean
ll_contains
(int fsAddr) Get a low-level, FS reference iterator.(package private) int
(package private) int
(package private) int
moveToNext
(int itPos) (package private) int
moveToPrevious
(int itPos) pointerIterator
(IntComparator comp, int[] detectIllegalIndexUpdates, int typeCode) protected IntPointerIterator
protected IntPointerIterator
refIterator
(int fsCode) 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, 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
-
USE_POSITIVE_INT_SET
static final boolean USE_POSITIVE_INT_SET -
index
-
indexP
-
initialSize
private int initialSize
-
-
Constructor Details
-
FSBagIndex
-
-
Method Details
-
init
- Overrides:
init
in classFSLeafIndexImpl<T extends FeatureStructure>
- See Also:
-
flush
public void flush() -
insert
public final boolean insert(int fs) - Specified by:
insert
in classFSLeafIndexImpl<T extends FeatureStructure>
-
find
private int find(int ele) - Parameters:
ele
- the element to find- Returns:
- the position of the element, or if not found, -1
-
findLeftmost
int findLeftmost(int ele) Left most in case there are multiple instances of the same item This only works if not use Positive Int Set because that's the only time there are multiple instances of the same (meaning having the same heap address) item- Parameters:
ele
- the featuresturcture to match- Returns:
- -1 if the item is not found, or a position value that can be used with iterators to start at that item.
-
compare
public int compare(int fs1, int fs2) For bag indexes, compare equal only if identical addresses- 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
-
pointerIterator
public ComparableIntPointerIterator<T> pointerIterator(IntComparator comp, int[] detectIllegalIndexUpdates, int typeCode) - 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
- A Feature Structure used a template to match for equality with the FSs in the index.- Returns:
true
if the index contains such an element.- See Also:
-
ll_contains
boolean ll_contains(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
-
hashCode
public int hashCode()- Overrides:
hashCode
in classFSLeafIndexImpl<T extends FeatureStructure>
-
insert
boolean insert(int fs, int count) - Specified by:
insert
in classFSLeafIndexImpl<T extends FeatureStructure>
-
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
-
isValid
boolean isValid(int itPos) -
moveToFirst
int moveToFirst() -
moveToLast
int moveToLast() -
moveToNext
int moveToNext(int itPos) -
moveToPrevious
int moveToPrevious(int itPos) -
get
int get(int itPos)
-