T
- the Java cover class type for this index, passed along to (wrapped)
iterators producing Java cover classespublic abstract class FsIndex_singletype<T extends FeatureStructure> extends AbstractCollection<T> implements Comparator<FeatureStructure>, LowLevelIndex<T>
Modifier and Type | Field and Description |
---|---|
protected CASImpl |
casImpl |
protected FSIndexComparatorImpl |
comparatorForIndexSpecs
comparator for an index, passed in as an argument to the constructor
|
protected Comparator<TOP> |
comparatorNoTypeWithID
comparator (with id) (ignoring typeorder) - used within one type
|
protected Comparator<TOP> |
comparatorNoTypeWithoutID
comparator (without id) (ignoring typeorder) - used within one type - used
for iterator operations where the type is requested to be ignored
|
protected Comparator<TOP> |
comparatorWithID |
protected Comparator<TOP> |
comparatorWithoutID |
boolean |
isAnnotIdx |
protected TypeImpl |
type |
protected WeakReference<CopyOnWriteIndexPart<T>> |
wr_cow
common copy on write instance or null; starts out as null Iterator creation
initializes (if null).
|
FS_ID_COMPARATOR, IS_ORDERED, IS_TYPE_ORDER
BAG_INDEX, DEFAULT_BAG_INDEX, SET_INDEX, SORTED_INDEX
Modifier | Constructor and Description |
---|---|
protected |
FsIndex_singletype(CASImpl cas,
Type type,
int indexType,
FSIndexComparator comparatorForIndexSpecs)
Constructor for FsIndex_singletype.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assertFsTypeMatchesIndexType(FeatureStructure fs,
String operation) |
protected abstract void |
bulkAddTo(List<T> v)
For serialization: get all the items in this index and bulk add to an
List<T>
|
abstract int |
compare(FeatureStructure o1,
FeatureStructure o2)
This is required to avoid compilation error (but not in Eclipse) due to
ambiguous interface inheritance from both FeatureStructure and Comparator
|
int |
compare(int fs1,
int fs2) |
protected abstract CopyOnWriteIndexPart<T> |
createCopyOnWriteIndexPart() |
boolean |
equals(Object obj) |
void |
flush() |
CASImpl |
getCasImpl() |
Comparator<TOP> |
getComparator() |
FSIndexComparator |
getComparatorForIndexSpecs()
This is **NOT** a comparator for Feature Structures, but rather
something that compares two comparator specifications
|
FSIndexComparatorImpl |
getComparatorImplForIndexSpecs() |
CopyOnWriteIndexPart<T> |
getCopyOnWriteIndexPart() |
int |
getIndexingStrategy()
Return the indexing strategy.
|
protected CopyOnWriteIndexPart<T> |
getNonNullCow() |
Type |
getType()
Return the type of feature structures this index contains.
|
TypeImpl |
getTypeImpl() |
int |
hashCode() |
boolean |
isSorted() |
LowLevelIterator<T> |
iterator(FeatureStructure initialPositionFs)
Return an iterator over the index.
|
int |
ll_compare(int fs1,
int fs2)
Compare two Feature structures, referred to by IDs
|
LowLevelIterator<T> |
ll_iterator(boolean ambiguous)
Get a low-level, FS reference iterator.
|
protected void |
maybeCopy()
Called just before modifying an index if wr_cow has a value, tell that
value to create a preserving copy of the index part, and set wr_cow to null
|
String |
toString() |
FSIndex<T> |
withSnapshotIterators()
Creates a shared copy of this FSIndex configured to produce snapshot iterators
that don't throw ConcurrentModificationExceptions.
|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
getIntIterator, getSubIndex, getSubIndex, iterator, iterator, ll_iterator, ll_maxAnnotSpan, select, select, select, select, select
contains, find, size, stream, subType, subType
add, addAll, clear, contains, containsAll, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, toArray, toArray
protected final CASImpl casImpl
protected final FSIndexComparatorImpl comparatorForIndexSpecs
protected final Comparator<TOP> comparatorWithID
protected final Comparator<TOP> comparatorWithoutID
protected final Comparator<TOP> comparatorNoTypeWithID
protected final Comparator<TOP> comparatorNoTypeWithoutID
public final boolean isAnnotIdx
protected final TypeImpl type
protected WeakReference<CopyOnWriteIndexPart<T extends FeatureStructure>> wr_cow
protected FsIndex_singletype(CASImpl cas, Type type, int indexType, FSIndexComparator comparatorForIndexSpecs)
cas
- -type
- -indexType
- -comparatorForIndexSpecs
- -public String toString()
toString
in class AbstractCollection<T extends FeatureStructure>
public LowLevelIterator<T> iterator(FeatureStructure initialPositionFs)
FSIndex
get()
method is
greater than or equal to fs
, and any previous FS is less than FS
(the iterator is positioned at the earliest of equal values).
If no such position exists, the iterator will be invalid.iterator
in interface FSIndex<T extends FeatureStructure>
initialPositionFs
- A feature structure template (may be a supertype of T) having keys used in the index compare function,
specifying where to initially position the iterator.fs
, if it exists; else, an invalid iterator.public Comparator<TOP> getComparator()
getComparator
in interface LowLevelIndex<T extends FeatureStructure>
public FSIndexComparator getComparatorForIndexSpecs()
LowLevelIndex
getComparatorForIndexSpecs
in interface LowLevelIndex<T extends FeatureStructure>
public FSIndexComparatorImpl getComparatorImplForIndexSpecs()
public int getIndexingStrategy()
FSIndex
getIndexingStrategy
in interface FSIndex<T extends FeatureStructure>
SORTED_INDEX
, BAG_INDEX
or SET_INDEX
.public int ll_compare(int fs1, int fs2)
LowLevelIndex
ll_compare
in interface LowLevelIndex<T extends FeatureStructure>
fs1
- -fs2
- -public int compare(int fs1, int fs2)
fs1
- -fs2
- -public int hashCode()
hashCode
in interface Collection<T extends FeatureStructure>
hashCode
in class Object
public boolean equals(Object obj)
equals
in interface Collection<T extends FeatureStructure>
equals
in interface Comparator<FeatureStructure>
equals
in class Object
public Type getType()
FSIndex
getType
in interface FSIndex<T extends FeatureStructure>
FSIndex.getType()
public TypeImpl getTypeImpl()
protected abstract void bulkAddTo(List<T> v)
v
- the set of items to addpublic LowLevelIterator<T> ll_iterator(boolean ambiguous)
LowLevelIndex
ll_iterator
in interface LowLevelIndex<T extends FeatureStructure>
ambiguous
- When set to false
, iterator will be disambiguated.public CASImpl getCasImpl()
getCasImpl
in interface LowLevelIndex<T extends FeatureStructure>
public FSIndex<T> withSnapshotIterators()
FSIndex
withSnapshotIterators
in interface FSIndex<T extends FeatureStructure>
public boolean isSorted()
isSorted
in interface LowLevelIndex<T extends FeatureStructure>
protected CopyOnWriteIndexPart<T> getNonNullCow()
public CopyOnWriteIndexPart<T> getCopyOnWriteIndexPart()
protected abstract CopyOnWriteIndexPart<T> createCopyOnWriteIndexPart()
protected void maybeCopy()
public void flush()
flush
in interface LowLevelIndex<T extends FeatureStructure>
public abstract int compare(FeatureStructure o1, FeatureStructure o2)
compare
in interface Comparator<FeatureStructure>
compare
in interface FSIndex<T extends FeatureStructure>
o1
- the first Feature Structure to compareo2
- the second Feature Structure to compare-1
if fs1 < fs2
; 0
if
fs1 = fs2
; 1
else.protected final void assertFsTypeMatchesIndexType(FeatureStructure fs, String operation)
Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.