Package org.apache.uima.cas.impl
Class FeatureImpl
java.lang.Object
org.apache.uima.cas.impl.FeatureImpl
- All Implemented Interfaces:
Comparable<Feature>
,Feature
- Direct Known Subclasses:
FeatureImpl_jcas_only
The implementation of features in the type system. A featureImpl instance is shared by the top
defining type and all of its subtypes
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate short
private final int
private short
the 0 based offset for this feature ignoring ref/int distinction, in feature order, without regard to JCas implemented features; set at commit time used by v2 style de/serializersprivate final long
private final TypeImpl
final boolean
true for the feature which is the AnnotationBase sofa reference.final boolean
final boolean
true if the range is a long or doubleprivate final boolean
private final TypeImpl
final int
type class of the range, including CasSerializer List constantsprivate final String
static final FeatureImpl
Used by CAS Copier to denote missing featureprivate final SlotKinds.SlotKind
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
used to make singleton which is used for "missing feature"(package private)
FeatureImpl
(TypeImpl typeImpl, String shortName, TypeImpl rangeType, TypeSystemImpl tsi, boolean isMultipleRefsAllowed, SlotKinds.SlotKind slotKind) -
Method Summary
Modifier and TypeMethodDescriptionint
This should work across different type systems, for instance when using filtered serializationlong
Hashcode and equals are used, possibly for features in different type systems, where the features should be "equal".boolean
int
int
getCode()
Get the domain type for this feature.(package private) TypeImpl
getName()
Get the fully qualified name for this feature.int
getRange()
Get the range type for this feature.Get the unqualified, short name of this feature.int
hashCode()
long
boolean
Checks if there can be multiple references to values of this feature.(package private) void
setAdjustedOffset
(int offset) (package private) void
setOffset
(int offset) toString()
void
throw if v is not in the allowed value set of the range type
-
Field Details
-
featureCode
private final int featureCode -
featureOffset
private short featureOffsetthe 0 based offset for this feature ignoring ref/int distinction, in feature order, without regard to JCas implemented features; set at commit time used by v2 style de/serializers -
adjustedFeatureOffset
private short adjustedFeatureOffset -
isInInt
public final boolean isInInt -
isMultipleRefsAllowed
private final boolean isMultipleRefsAllowed -
isLongOrDouble
public final boolean isLongOrDoubletrue if the range is a long or double -
highestDefiningType
-
rangeType
-
isAnnotBaseSofaRef
public final boolean isAnnotBaseSofaReftrue for the feature which is the AnnotationBase sofa reference. -
shortName
-
slotKind
-
rangeTypeClass
public final int rangeTypeClasstype class of the range, including CasSerializer List constants -
hashCodeLong
private final long hashCodeLong -
singleton
Used by CAS Copier to denote missing feature
-
-
Constructor Details
-
FeatureImpl
private FeatureImpl()used to make singleton which is used for "missing feature" -
FeatureImpl
FeatureImpl(TypeImpl typeImpl, String shortName, TypeImpl rangeType, TypeSystemImpl tsi, boolean isMultipleRefsAllowed, SlotKinds.SlotKind slotKind)
-
-
Method Details
-
getCode
public int getCode()- Returns:
- the internal code of this feature. Necessary when using low-level APIs.
-
getDomain
Get the domain type for this feature. -
getRange
Get the range type for this feature. * @return The range type. This can not benull
. -
getRangeImpl
-
getSlotKind
-
getName
Get the fully qualified name for this feature. The Feature qualifier is that of the highest defining type. -
getShortName
Description copied from interface:Feature
Get the unqualified, short name of this feature.- Specified by:
getShortName
in interfaceFeature
- Returns:
- The short name.
-
toString
-
isMultipleReferencesAllowed
public boolean isMultipleReferencesAllowed()Description copied from interface:Feature
Checks if there can be multiple references to values of this feature. This is only meaningful for array-valued or list-values features.If this is false it indicates that this feature has exclusive ownership of the array or list, so changes to the array or list are localized. If this is true it indicates that the array or list may be shared, so changes to it may affect other objects in the CAS.
- Specified by:
isMultipleReferencesAllowed
in interfaceFeature
- Returns:
true
iff the value type of this feature is an array or list and has been declared to allow multiple references.
-
getOffset
public int getOffset()- Returns:
- the 0-based offset for this feature
-
setOffset
void setOffset(int offset) -
getAdjustedOffset
public int getAdjustedOffset() -
setAdjustedOffset
void setAdjustedOffset(int offset) -
getHighestDefiningType
TypeImpl getHighestDefiningType() -
validateIsInAllowedValue
throw if v is not in the allowed value set of the range type- Parameters:
v
- the value to check
-
hashCode
public int hashCode() -
hashCodeLong
public long hashCodeLong() -
computeHashCodeLong
public long computeHashCodeLong()Hashcode and equals are used, possibly for features in different type systems, where the features should be "equal". Example: fitering during serialization.- Returns:
- long version of hashcode
-
compareTo
This should work across different type systems, for instance when using filtered serialization- Specified by:
compareTo
in interfaceComparable<Feature>
-
equals
-