Class FeatureStructureImpl

  • All Implemented Interfaces:
    java.lang.Cloneable, FeatureStructure
    Direct Known Subclasses:
    FeatureStructureImplC, TOP

    public abstract class FeatureStructureImpl
    extends java.lang.Object
    implements FeatureStructure, java.lang.Cloneable
    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 Detail

      • FeatureStructureImpl

        public FeatureStructureImpl()
    • Method Detail

      • getAddress

        public abstract int getAddress()
      • getCASImpl

        protected abstract CASImpl getCASImpl()
      • getavoidcollisionTypeCode

        public int getavoidcollisionTypeCode()
      • setIntValue

        public void setIntValue​(Feature feat,
                                int val)
        Description copied from interface: FeatureStructure
        Set the int value of a feature.
        Specified by:
        setIntValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to set.
        val - The int we're setting the feature to.
      • setFloatValue

        public void setFloatValue​(Feature feat,
                                  float val)
        Description copied from interface: FeatureStructure
        Set the float value of a feature.
        Specified by:
        setFloatValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to set.
        val - The float we're setting the feature to.
      • setStringValue

        public void setStringValue​(Feature feat,
                                   java.lang.String val)
        Description copied from interface: FeatureStructure
        Set the string value of a feature.
        Specified by:
        setStringValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to set.
        val - The string we're setting the feature to.
      • setFeatureValueFromString

        public void setFeatureValueFromString​(Feature feat,
                                              java.lang.String s)
                                       throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Sets the value of a feature from a string input if the feature type is one of the primitive types.
        Specified by:
        setFeatureValueFromString in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to set.
        s - The string value that the feature will be set to.
        Throws:
        CASRuntimeException - If feat is not a primitive type or the value cannot be converted to this type.
      • getIntValue

        public int getIntValue​(Feature feat)
        Description copied from interface: FeatureStructure
        Get the int value of a feature. This method will throw an exception if the feature is not int valued.
        Specified by:
        getIntValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to get.
        Returns:
        The value int; 0 if the value has not been set.
      • getFloatValue

        public float getFloatValue​(Feature feat)
                            throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Get the float value of a feature. This method will throw an exception if the feature is not float valued.
        Specified by:
        getFloatValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to get.
        Returns:
        The value float; 0.0 if the value has not been set.
        Throws:
        CASRuntimeException - If feat is not defined for the type of this FS, or if it is not float valued.
      • getStringValue

        public java.lang.String getStringValue​(Feature f)
                                        throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Get the string value under a feature.
        Specified by:
        getStringValue in interface FeatureStructure
        Parameters:
        f - The feature for which we want the value.
        Returns:
        The value of this feature; may be null if the value has not been set.
        Throws:
        CASRuntimeException - If there is a typing violation, i.e., if f is not defined for the type of this feature structure, or if the range type of f is not String.
      • getByteValue

        public byte getByteValue​(Feature feat)
                          throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Get the byte value of a feature. This method will throw an exception if the feature is not byte valued.
        Specified by:
        getByteValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to set.
        Returns:
        The value byte; 0 if the value has not been set.
        Throws:
        CASRuntimeException - tbd
      • getBooleanValue

        public boolean getBooleanValue​(Feature feat)
                                throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Get the boolean value of a feature. This method will throw an exception if the feature is not boolean valued.
        Specified by:
        getBooleanValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to get.
        Returns:
        The value int; 0 if the value has not been set.
        Throws:
        CASRuntimeException - If feat is not defined for the type of this FS, or if it is not boolean valued.
      • getShortValue

        public short getShortValue​(Feature feat)
                            throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Get the short value of a feature. This method will throw an exception if the feature is not short valued.
        Specified by:
        getShortValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to get.
        Returns:
        The value int; 0 if the value has not been set.
        Throws:
        CASRuntimeException - If feat is not defined for the type of this FS, or if it is not short valued.
      • getLongValue

        public long getLongValue​(Feature feat)
                          throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Get the long value of a feature. This method will throw an exception if the feature is not long valued.
        Specified by:
        getLongValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to get.
        Returns:
        The value int; 0 if the value has not been set.
        Throws:
        CASRuntimeException - If feat is not defined for the type of this FS, or if it is not long valued.
      • getDoubleValue

        public double getDoubleValue​(Feature feat)
                              throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Get the double value of a feature. This method will throw an exception if the feature is not double valued.
        Specified by:
        getDoubleValue in interface FeatureStructure
        Parameters:
        feat - The feature whose value we want to get.
        Returns:
        The value int; 0 if the value has not been set.
        Throws:
        CASRuntimeException - If feat is not defined for the type of this FS, or if it is not double valued.
      • getFeatureValueAsString

        public java.lang.String getFeatureValueAsString​(Feature feat)
                                                 throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Get the value of the feature as a string if the type of the feature is one of the primitive type.
        Specified by:
        getFeatureValueAsString in interface FeatureStructure
        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 - If feat is not defined for the type of this FS, or if the type is not a primitive type.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        public java.lang.String toString​(int indent)
      • prettyPrint

        public void prettyPrint​(int indent,
                                int incr,
                                java.lang.StringBuffer buf,
                                boolean useShortNames)
      • prettyPrint

        public void prettyPrint​(int indent,
                                int incr,
                                java.lang.StringBuffer buf,
                                boolean useShortNames,
                                java.lang.String s)
      • prettyPrint

        public void prettyPrint​(int indent,
                                int incr,
                                java.lang.StringBuffer buf,
                                boolean useShortNames,
                                java.lang.String s,
                                org.apache.uima.cas.impl.FeatureStructureImpl.PrintReferences printRefs)
      • clone

        public java.lang.Object clone()
                               throws CASRuntimeException
        Description copied from interface: FeatureStructure
        Creates 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:
        clone in interface FeatureStructure
        Overrides:
        clone in class java.lang.Object
        Returns:
        a FeatureStructure that is the cloned copy of this FeatureStructure.
        Throws:
        CASRuntimeException - passthru