Package org.apache.uima.cas.impl
Class FeatureImpl
- java.lang.Object
-
- org.apache.uima.cas.impl.FeatureImpl
-
- Direct Known Subclasses:
FeatureImpl_jcas_only
public class FeatureImpl extends java.lang.Object implements Feature
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
Fields Modifier and Type Field Description private shortadjustedFeatureOffsetprivate intfeatureCodeprivate shortfeatureOffsetthe 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 longhashCodeLongprivate TypeImplhighestDefiningTypebooleanisAnnotBaseSofaReftrue for the feature which is the AnnotationBase sofa reference.booleanisInIntbooleanisLongOrDoubletrue if the range is a long or doubleprivate booleanisMultipleRefsAllowedprivate TypeImplrangeTypeintrangeTypeClasstype class of the range, including CasSerializer List constantsprivate java.lang.StringshortNamestatic FeatureImplsingletonUsed by CAS Copier to denote missing featureprivate SlotKinds.SlotKindslotKind
-
Constructor Summary
Constructors Modifier Constructor Description privateFeatureImpl()used to make singleton which is used for "missing feature"(package private)FeatureImpl(TypeImpl typeImpl, java.lang.String shortName, TypeImpl rangeType, TypeSystemImpl tsi, boolean isMultipleRefsAllowed, SlotKinds.SlotKind slotKind)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Feature o)This should work across different type systems, for instance when using filtered serializationlongcomputeHashCodeLong()Hashcode and equals are used, possibly for features in different type systems, where the features should be "equal".booleanequals(java.lang.Object obj)intgetAdjustedOffset()intgetCode()TypegetDomain()Get the domain type for this feature.(package private) TypeImplgetHighestDefiningType()java.lang.StringgetName()Get the fully qualified name for this feature.intgetOffset()TypegetRange()Get the range type for this feature.TypeImplgetRangeImpl()java.lang.StringgetShortName()Get the unqualified, short name of this feature.SlotKinds.SlotKindgetSlotKind()inthashCode()longhashCodeLong()booleanisMultipleReferencesAllowed()Checks if there can be multiple references to values of this feature.(package private) voidsetAdjustedOffset(int offset)(package private) voidsetOffset(int offset)java.lang.StringtoString()voidvalidateIsInAllowedValue(java.lang.String v)throw if v is not in the allowed value set of the range type
-
-
-
Field Detail
-
featureCode
private final int featureCode
-
featureOffset
private short featureOffset
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/serializers
-
adjustedFeatureOffset
private short adjustedFeatureOffset
-
isInInt
public final boolean isInInt
-
isMultipleRefsAllowed
private final boolean isMultipleRefsAllowed
-
isLongOrDouble
public final boolean isLongOrDouble
true if the range is a long or double
-
highestDefiningType
private final TypeImpl highestDefiningType
-
rangeType
private final TypeImpl rangeType
-
isAnnotBaseSofaRef
public final boolean isAnnotBaseSofaRef
true for the feature which is the AnnotationBase sofa reference.
-
shortName
private final java.lang.String shortName
-
slotKind
private final SlotKinds.SlotKind slotKind
-
rangeTypeClass
public final int rangeTypeClass
type class of the range, including CasSerializer List constants
-
hashCodeLong
private final long hashCodeLong
-
singleton
public static final FeatureImpl singleton
Used by CAS Copier to denote missing feature
-
-
Constructor Detail
-
FeatureImpl
private FeatureImpl()
used to make singleton which is used for "missing feature"
-
FeatureImpl
FeatureImpl(TypeImpl typeImpl, java.lang.String shortName, TypeImpl rangeType, TypeSystemImpl tsi, boolean isMultipleRefsAllowed, SlotKinds.SlotKind slotKind)
-
-
Method Detail
-
getCode
public int getCode()
- Returns:
- the internal code of this feature. Necessary when using low-level APIs.
-
getDomain
public Type getDomain()
Get the domain type for this feature.
-
getRange
public Type getRange()
Get the range type for this feature. * @return The range type. This can not benull.
-
getRangeImpl
public TypeImpl getRangeImpl()
-
getSlotKind
public SlotKinds.SlotKind getSlotKind()
-
getName
public java.lang.String getName()
Get the fully qualified name for this feature. The Feature qualifier is that of the highest defining type.
-
getShortName
public java.lang.String getShortName()
Description copied from interface:FeatureGet the unqualified, short name of this feature.- Specified by:
getShortNamein interfaceFeature- Returns:
- The short name.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isMultipleReferencesAllowed
public boolean isMultipleReferencesAllowed()
Description copied from interface:FeatureChecks 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:
isMultipleReferencesAllowedin interfaceFeature- Returns:
trueiff 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
public void validateIsInAllowedValue(java.lang.String v)
throw if v is not in the allowed value set of the range type- Parameters:
v- the value to check
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
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
public int compareTo(Feature o)
This should work across different type systems, for instance when using filtered serialization- Specified by:
compareToin interfacejava.lang.Comparable<Feature>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-