Package org.apache.uima.cas.impl
Class FeatureStructureImpl
java.lang.Object
org.apache.uima.cas.impl.FeatureStructureImpl
- All Implemented Interfaces:
Cloneable,FeatureStructure
- Direct Known Subclasses:
FeatureStructureImplC,TOP
Feature structure implementation.
This is the common super class of all Feature Structures
including the JCAS (derived from TOP)
and non JCas FSs
- Version:
- $Revision: 1.6 $
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a copy of this feature structure.abstract intintbooleangetBooleanValue(Feature feat) Get the boolean value of a feature.bytegetByteValue(Feature feat) Get the byte value of a feature.protected abstract CASImpldoublegetDoubleValue(Feature feat) Get the double value of a feature.getFeatureValue(Feature feat) Get a feature value.Get the value of the feature as a string if the type of the feature is one of the primitive type.floatgetFloatValue(Feature feat) Get the float value of a feature.intgetIntValue(Feature feat) Get the int value of a feature.longgetLongValue(Feature feat) Get the long value of a feature.shortgetShortValue(Feature feat) Get the short value of a feature.Get the string value under a feature.getType()Get the type of this FS.voidprettyPrint(int indent, int incr, StringBuffer buf, boolean useShortNames) voidprettyPrint(int indent, int incr, StringBuffer buf, boolean useShortNames, String s) voidprettyPrint(int indent, int incr, StringBuffer buf, boolean useShortNames, String s, org.apache.uima.cas.impl.FeatureStructureImpl.PrintReferences printRefs) voidsetBooleanValue(Feature feat, boolean b) Set the boolean value of a feature.voidsetByteValue(Feature feat, byte val) Set the byte (8 bit) value of a feature.voidsetDoubleValue(Feature feat, double val) Set the double value of a feature.voidsetFeatureValue(Feature feat, FeatureStructure fs) Set a feature value to another FS.voidsetFeatureValueFromString(Feature feat, String s) Sets the value of a feature from a string input if the feature type is one of the primitive types.voidsetFloatValue(Feature feat, float val) Set the float value of a feature.voidsetIntValue(Feature feat, int val) Set the int value of a feature.voidsetLongValue(Feature feat, long val) Set the long (64 bit) value of a feature.voidsetShortValue(Feature feat, short val) Set the short (16 bit) value of a feature.voidsetStringValue(Feature feat, String val) Set the string value of a feature.toString()toString(int indent) Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.uima.cas.FeatureStructure
equals, getCAS, hashCode
-
Constructor Details
-
FeatureStructureImpl
public FeatureStructureImpl()
-
-
Method Details
-
getAddress
public abstract int getAddress() -
getCASImpl
-
getType
Description copied from interface:FeatureStructureGet the type of this FS.- Specified by:
getTypein interfaceFeatureStructure- Returns:
- The type.
-
getavoidcollisionTypeCode
public int getavoidcollisionTypeCode() -
setFeatureValue
Description copied from interface:FeatureStructureSet a feature value to another FS.- Specified by:
setFeatureValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value should be set.fs- The value FS.
-
setIntValue
Description copied from interface:FeatureStructureSet the int value of a feature.- Specified by:
setIntValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.val- The int we're setting the feature to.
-
setFloatValue
Description copied from interface:FeatureStructureSet the float value of a feature.- Specified by:
setFloatValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.val- The float we're setting the feature to.
-
setStringValue
Description copied from interface:FeatureStructureSet the string value of a feature.- Specified by:
setStringValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.val- The string we're setting the feature to.
-
setByteValue
Description copied from interface:FeatureStructureSet the byte (8 bit) value of a feature.- Specified by:
setByteValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.val- The 8bit value we're setting the feature to.- Throws:
CASRuntimeException- tbd
-
setBooleanValue
Description copied from interface:FeatureStructureSet the boolean value of a feature.- Specified by:
setBooleanValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.b- The boolean value we're setting the feature to.- Throws:
CASRuntimeException
-
setShortValue
Description copied from interface:FeatureStructureSet the short (16 bit) value of a feature.- Specified by:
setShortValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.val- The short (16bit) value we're setting the feature to.- Throws:
CASRuntimeException
-
setLongValue
Description copied from interface:FeatureStructureSet the long (64 bit) value of a feature.- Specified by:
setLongValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.val- The long (64bit) value we're setting the feature to.- Throws:
CASRuntimeException
-
setDoubleValue
Description copied from interface:FeatureStructureSet the double value of a feature.- Specified by:
setDoubleValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.val- The double value we're setting the feature to.- Throws:
CASRuntimeException
-
setFeatureValueFromString
Description copied from interface:FeatureStructureSets the value of a feature from a string input if the feature type is one of the primitive types.- Specified by:
setFeatureValueFromStringin interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.s- The string value that the feature will be set to.- Throws:
CASRuntimeException- Iffeatis not a primitive type or the value cannot be converted to this type.
-
getFeatureValue
Description copied from interface:FeatureStructureGet a feature value.- Specified by:
getFeatureValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value; may be
nullif the value has not been set. - Throws:
CASRuntimeException- If there is a typing violation, i.e., iffeatis not defined for the type of this FS, or the range type offeatis Float, Integer or String.
-
getIntValue
Description copied from interface:FeatureStructureGet the int value of a feature. This method will throw an exception if the feature is not int valued.- Specified by:
getIntValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set.
-
getFloatValue
Description copied from interface:FeatureStructureGet the float value of a feature. This method will throw an exception if the feature is not float valued.- Specified by:
getFloatValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value float;
0.0if the value has not been set. - Throws:
CASRuntimeException- Iffeatis not defined for the type of this FS, or if it is not float valued.
-
getStringValue
Description copied from interface:FeatureStructureGet the string value under a feature.- Specified by:
getStringValuein interfaceFeatureStructure- Parameters:
f- The feature for which we want the value.- Returns:
- The value of this feature; may be
nullif the value has not been set. - Throws:
CASRuntimeException- If there is a typing violation, i.e., iffis not defined for the type of this feature structure, or if the range type offis not String.
-
getByteValue
Description copied from interface:FeatureStructureGet the byte value of a feature. This method will throw an exception if the feature is not byte valued.- Specified by:
getByteValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.- Returns:
- The value byte;
0if the value has not been set. - Throws:
CASRuntimeException- tbd
-
getBooleanValue
Description copied from interface:FeatureStructureGet the boolean value of a feature. This method will throw an exception if the feature is not boolean valued.- Specified by:
getBooleanValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set. - Throws:
CASRuntimeException- Iffeatis not defined for the type of this FS, or if it is not boolean valued.
-
getShortValue
Description copied from interface:FeatureStructureGet the short value of a feature. This method will throw an exception if the feature is not short valued.- Specified by:
getShortValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set. - Throws:
CASRuntimeException- Iffeatis not defined for the type of this FS, or if it is not short valued.
-
getLongValue
Description copied from interface:FeatureStructureGet the long value of a feature. This method will throw an exception if the feature is not long valued.- Specified by:
getLongValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set. - Throws:
CASRuntimeException- Iffeatis not defined for the type of this FS, or if it is not long valued.
-
getDoubleValue
Description copied from interface:FeatureStructureGet the double value of a feature. This method will throw an exception if the feature is not double valued.- Specified by:
getDoubleValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set. - Throws:
CASRuntimeException- Iffeatis not defined for the type of this FS, or if it is not double valued.
-
getFeatureValueAsString
Description copied from interface:FeatureStructureGet the value of the feature as a string if the type of the feature is one of the primitive type.- Specified by:
getFeatureValueAsStringin interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get and whose type is one of the primitve types.- Returns:
- A string representation of the feature value.
- Throws:
CASRuntimeException- Iffeatis not defined for the type of this FS, or if the type is not a primitive type.
-
toString
-
toString
-
prettyPrint
-
prettyPrint
-
prettyPrint
public void prettyPrint(int indent, int incr, StringBuffer buf, boolean useShortNames, String s, org.apache.uima.cas.impl.FeatureStructureImpl.PrintReferences printRefs) -
clone
Description copied from interface:FeatureStructureCreates a copy of this feature structure. The returned feature structure is a new and separate object but all features of the feature structure which are not of builtin types (integer, float, string) will be shared between the clone and it's source FS.- Specified by:
clonein interfaceFeatureStructure- Overrides:
clonein classObject- Returns:
- a FeatureStructure that is the cloned copy of this FeatureStructure.
- Throws:
CASRuntimeException- passthru
-