Package org.apache.uima.cas.impl
Class FeaturePathImpl
java.lang.Object
org.apache.uima.cas.impl.FeaturePathImpl
- All Implemented Interfaces:
FeaturePath
Implementation of the feature path interface.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TypeImplThe Type used as the starting type for path validation This must be non-null if boundFeatures size > 0;private final ArrayList<FeatureImpl> FeatureImpl array corresponding to feature path names.private static final Stringprivate byteThe path's builtInFunction, or 0private static final TOPprivate static final Stringprivate static final byteprivate static final byteprivate static final Stringprivate static final Stringprivate static final Stringprivate static final byteprivate static final Stringprivate static final byteprivate Stringprivate booleanprivate FeatureImplprivate TypeImpl -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFeature(Feature feat) Add a new feature at the end of the path.private voidprivate StringevaluateBuiltInFunction(TOP returnFS) evaluate the built-in function for the returned FeatureStructureReturns the Boolean value of a boolean valued feature path.Returns the Byte value of a byte valued feature path.Returns the Double value of a double valued feature path.getFeature(int i) Get feature at position.Returns the feature path as string.private StringReturns the Float value of a float valued feature path.Returns the FeatureStructure of a FeatureStructure valued feature path.Returns the Integer value of an integer valued feature path.Returns the Long value of a long valued feature path.Returns the Short value of a short valued feature path.Returns the String value of a string valued feature path.private TOPgetTargetFs(TOP fs) evaluates the internal feature path for the given FeatureStructure returnsDeprecated.Returns the type of the feature path.Returns the type class of the feature path.Returns the feature path value as string for the given FeatureStructure.voidinitialize(String featurePath) Initialize the feature path object with the given feature path string.ll_getValueAsString(int fsRef, LowLevelCAS llCas) Returns the feature path value as string for the given FeatureStructure.private voidsetTargetFeature(TOP currentFs, int i) intsize()Get length of path.private voidthrowBuiltInFunctionException(String typeName) Method that throws the CASRuntimeException for an unsupported built-in functionvoidCheck the feature path for the given type and initialize internal structures for faster access to the feature path value.private void
-
Field Details
-
MESSAGE_DIGEST
- See Also:
-
FEATURE_PATH_SEPARATOR
- See Also:
-
BUILT_IN_FUNCTION_SEPARATOR
- See Also:
-
NO_BUILT_IN_FUNCTION
private static final byte NO_BUILT_IN_FUNCTION- See Also:
-
FUNCTION_COVERED_TEXT
private static final byte FUNCTION_COVERED_TEXT- See Also:
-
FUNCTION_ID
private static final byte FUNCTION_ID- See Also:
-
FUNCTION_TYPE_NAME
private static final byte FUNCTION_TYPE_NAME- See Also:
-
FUNCTION_NAME_COVERED_TEXT
- See Also:
-
FUNCTION_NAME_ID
- See Also:
-
FUNCTION_NAME_TYPE_NAME
- See Also:
-
FEATURE_PATH_FAILED
-
builtInFunction
private byte builtInFunctionThe path's builtInFunction, or 0 -
originalBuiltInName
-
featurePathElementNames
-
pathStartsWithSlash
private boolean pathStartsWithSlash -
boundFeatures
FeatureImpl array corresponding to feature path names. This can change for each evaluation of this FeaturePath instance against a different starting Feature Structure. It can be pre-set-up using typeInit. It has values for the first names in the featurePathElementNames which are always valid for a given starting type (set into boundBaseType). -
targetFeature
-
targetType
-
boundBaseType
The Type used as the starting type for path validation This must be non-null if boundFeatures size > 0;
-
-
Constructor Details
-
FeaturePathImpl
FeaturePathImpl()
-
-
Method Details
-
addFeature
Description copied from interface:FeaturePathAdd a new feature at the end of the path.- Specified by:
addFeaturein interfaceFeaturePath- Parameters:
feat- The feature to be added.
-
getFeature
Description copied from interface:FeaturePathGet feature at position.- Specified by:
getFeaturein interfaceFeaturePath- Parameters:
i- The position in the path (starting at0).- Returns:
- The feature, or
nullif there is no such feature.
-
size
public int size()Description copied from interface:FeaturePathGet length of path.- Specified by:
sizein interfaceFeaturePath- Returns:
- An integer
>= 0.
-
initialize
Description copied from interface:FeaturePathInitialize the feature path object with the given feature path string.- Specified by:
initializein interfaceFeaturePath- Parameters:
featurePath- The featurePath that is used for this feature path object.- Throws:
CASException- Throws an exception if the feature path syntax is invalid.
-
typeInit
Description copied from interface:FeaturePathCheck the feature path for the given type and initialize internal structures for faster access to the feature path value.- Specified by:
typeInitin interfaceFeaturePath- Parameters:
typeAtStartOfFeaturePath- The type the feature path should be used on.- Throws:
CASException- Throws an exception if the feature path is not valid for the given type
-
getFeaturePath
Description copied from interface:FeaturePathReturns the feature path as string.- Specified by:
getFeaturePathin interfaceFeaturePath- Returns:
- Returns the feature path as string.
-
getBooleanValue
Description copied from interface:FeaturePathReturns the Boolean value of a boolean valued feature path.- Specified by:
getBooleanValuein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the Boolean value of a boolean valued feature path or null if the feature path was not set
-
getByteValue
Description copied from interface:FeaturePathReturns the Byte value of a byte valued feature path.- Specified by:
getByteValuein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the Byte value of a byte valued feature path or null if the feature path was not set
-
getDoubleValue
Description copied from interface:FeaturePathReturns the Double value of a double valued feature path.- Specified by:
getDoubleValuein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the Double value of a double valued feature path or null if the feature path was not set
-
getFloatValue
Description copied from interface:FeaturePathReturns the Float value of a float valued feature path.- Specified by:
getFloatValuein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the Float value of a float valued feature path or null if the feature path was not set
-
getFSValue
Description copied from interface:FeaturePathReturns the FeatureStructure of a FeatureStructure valued feature path.- Specified by:
getFSValuein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the FeatureStructure value of a FeatureStructure valued feature path or null if the feature path was not set
-
getIntValue
Description copied from interface:FeaturePathReturns the Integer value of an integer valued feature path.- Specified by:
getIntValuein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the Integer value of a integer valued feature path or null if the feature path was not set
-
getLongValue
Description copied from interface:FeaturePathReturns the Long value of a long valued feature path.- Specified by:
getLongValuein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the Long value of a long valued feature path or null if the feature path was not set
-
getShortValue
Description copied from interface:FeaturePathReturns the Short value of a short valued feature path.- Specified by:
getShortValuein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the Short value of a short valued feature path or null if the feature path was not set
-
getStringValue
Description copied from interface:FeaturePathReturns the String value of a string valued feature path.- Specified by:
getStringValuein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the String value of a string valued feature path or null if the feature path was not set
-
getType
Description copied from interface:FeaturePathReturns the type of the feature path.- Specified by:
getTypein interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path type- Returns:
- Returns the type of the feature path or null if the feature path is not set.
-
getTypClass
Deprecated.Description copied from interface:FeaturePathReturns the type class of the feature path.- Specified by:
getTypClassin interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path type class- Returns:
- Returns the type class of the feature path or null if the feature path is not set
-
getTypeClass
Description copied from interface:FeaturePathReturns the type class of the feature path.- Specified by:
getTypeClassin interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path type class- Returns:
- Returns the type class of the feature path or null if the feature path is not set
-
ll_getValueAsString
Description copied from interface:FeaturePathReturns the feature path value as string for the given FeatureStructure. If the feature path contains a built-in function it is evaluated and the built-in function value is returned. If the feature path ends with an array the array is converted to a comma separated string.- Specified by:
ll_getValueAsStringin interfaceFeaturePath- Parameters:
fsRef- FeatureStructure reference (LowLevel API) to evaluate the feature path valuellCas- LowLevelCAS for the fsRef- Returns:
- Returns the value of the feature path as String
-
getValueAsString
Description copied from interface:FeaturePathReturns the feature path value as string for the given FeatureStructure. If the feature path ends in a built-in function it is evaluated and the built-in function value is returned; this is the only method which evaluates built-in functions If the feature path ends with an array the array is converted to a comma separated string.- Specified by:
getValueAsStringin interfaceFeaturePath- Parameters:
fs- FeatureStructure to evaluate the feature path value- Returns:
- Returns the value of the feature path as String or null if the feature path was not set or some features along the path were null.
-
throwBuiltInFunctionException
Method that throws the CASRuntimeException for an unsupported built-in function- Parameters:
typeName- type name that does not support the built-in function
-
evaluateBuiltInFunction
evaluate the built-in function for the returned FeatureStructure- Parameters:
returnFS- FeatureStructure that is returned- Returns:
- Returns the built-in function value for the given FS.
-
getTargetFs
evaluates the internal feature path for the given FeatureStructure returns- Parameters:
fs- FeatureStructure to use as the starting point for the feature path- Returns:
- the Feature Structure result, or the Feature Structure to run feature or array extraction on, or the Feature Structure to run a built-in function on or null (meaning no fs was found that matched the path). For 0 element feature paths, this is the same as the argument. For null fs, the returned value is null;
-
setTargetFeature
-
verifyNoBuiltInFunction
private void verifyNoBuiltInFunction() -
getFeaturePathString
-
appendBuiltInFunction
-