Package org.apache.uima.cas.impl
Class FSIndexComparatorImpl
- java.lang.Object
-
- org.apache.uima.cas.impl.FSIndexComparatorImpl
-
- All Implemented Interfaces:
java.lang.Comparable<FSIndexComparator>,FSIndexComparator
public class FSIndexComparatorImpl extends java.lang.Object implements FSIndexComparator
Specifies the comparison to be used for an index, in terms of - the keys and the typeorder, in an order - the standard/reverse ordering
-
-
Field Summary
Fields Modifier and Type Field Description private IntVectordirectionsprivate java.util.List<java.lang.Object>keySpecsprivate Typetype-
Fields inherited from interface org.apache.uima.cas.admin.FSIndexComparator
FEATURE_KEY, REVERSE_STANDARD_COMPARE, STANDARD_COMPARE, TYPE_ORDER_KEY
-
-
Constructor Summary
Constructors Modifier Constructor Description FSIndexComparatorImpl()privateFSIndexComparatorImpl(Type type, java.util.List<java.lang.Object> keySpecs, IntVector directions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddKey(LinearTypeOrder typeOrder, int compareKey)intaddKey(Feature feat, int compareKey)Add a new key.private booleancheckType(Type t)intcompareTo(FSIndexComparator o)Compares two FSIndexComparator instances.FSIndexComparatorImplcopy()booleanequals(java.lang.Object o)Equals including the type of the comparator(package private) booleanequalsWithoutType(FSIndexComparatorImpl comp)Compare two comparators, ignoring the typeintgetKeyComparator(int key)Get the comparator for this key.FeatureImplgetKeyFeature(int key)Get the feature for this key.intgetKeyType(int key)LinearTypeOrdergetKeyTypeOrder(int key)intgetNumberOfKeys()Return the number of keys.TypegetType()Get the type of this comparator.(package private) intgetTypeCode()inthashCode()booleanisValid()Validate that this comparator is valid with respect to the type system.voidsetType(Type type)Set the type of this comparator.
-
-
-
Method Detail
-
checkType
private boolean checkType(Type t)
-
setType
public void setType(Type type)
Description copied from interface:FSIndexComparatorSet the type of this comparator. Note that you can use this method more than once, in case you need to generate indexes that are identical except for the type.- Specified by:
setTypein interfaceFSIndexComparator- Parameters:
type- The type of the index.
-
getType
public Type getType()
Description copied from interface:FSIndexComparatorGet the type of this comparator.- Specified by:
getTypein interfaceFSIndexComparator- Returns:
- The type of the comparator.
-
getTypeCode
int getTypeCode()
-
addKey
public int addKey(Feature feat, int compareKey)
Description copied from interface:FSIndexComparatorAdd a new key.- Specified by:
addKeyin interfaceFSIndexComparator- Parameters:
feat- The key feature.compareKey- The way to compare the key values.- Returns:
- The number of the key.
-
addKey
public int addKey(LinearTypeOrder typeOrder, int compareKey)
- Specified by:
addKeyin interfaceFSIndexComparator- Parameters:
typeOrder- the type ordercompareKey- the direction- Returns:
- the number of the key
-
getKeyType
public int getKeyType(int key)
- Specified by:
getKeyTypein interfaceFSIndexComparator
-
getNumberOfKeys
public int getNumberOfKeys()
Description copied from interface:FSIndexComparatorReturn the number of keys.- Specified by:
getNumberOfKeysin interfaceFSIndexComparator- Returns:
- the number of keys.
-
getKeyFeature
public FeatureImpl getKeyFeature(int key)
Description copied from interface:FSIndexComparatorGet the feature for this key.- Specified by:
getKeyFeaturein interfaceFSIndexComparator- Parameters:
key- The number of the key.- Returns:
- The corresponding feature, if it exists;
null, else.
-
getKeyTypeOrder
public LinearTypeOrder getKeyTypeOrder(int key)
-
getKeyComparator
public int getKeyComparator(int key)
Description copied from interface:FSIndexComparatorGet the comparator for this key.- Specified by:
getKeyComparatorin interfaceFSIndexComparator- Parameters:
key- The number of the key.- Returns:
- The corresponding comparator, if it exists;
-1, else.
-
equals
public boolean equals(java.lang.Object o)
Equals including the type of the comparator- Specified by:
equalsin interfaceFSIndexComparator- Overrides:
equalsin classjava.lang.Object
-
equalsWithoutType
boolean equalsWithoutType(FSIndexComparatorImpl comp)
Compare two comparators, ignoring the type- Parameters:
comp- the other comparator to compare to- Returns:
- true if they're the same comparator
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
isValid
public boolean isValid()
Description copied from interface:FSIndexComparatorValidate that this comparator is valid with respect to the type system. Note that all types and features used to define this comparator must come from the same type system. Note that this method only returns true or false. It doesn't tell you what's actually wrong. Maybe we need to change that?- Specified by:
isValidin interfaceFSIndexComparator- Returns:
trueiff all key features are appropriate for the type of this comparator.
-
copy
public FSIndexComparatorImpl copy()
-
compareTo
public int compareTo(FSIndexComparator o)
Compares two FSIndexComparator instances. The code to compare two FSs is in the compare method of FsIndex_singletype.- Specified by:
compareToin interfacejava.lang.Comparable<FSIndexComparator>- See Also:
Comparable.compareTo(Object)
-
-