Class FeatureSetImpl

java.lang.Object
com.sun.speech.freetts.FeatureSetImpl
All Implemented Interfaces:
Dumpable, FeatureSet

public class FeatureSetImpl extends Object implements FeatureSet
Implementation of the FeatureSet interface.
  • Constructor Details

    • FeatureSetImpl

      public FeatureSetImpl()
      Creates a new empty feature set
  • Method Details

    • isPresent

      public boolean isPresent(String name)
      Determines if the given feature is present.
      Specified by:
      isPresent in interface FeatureSet
      Parameters:
      name - the name of the feature of interest
      Returns:
      true if the named feature is present
    • remove

      public void remove(String name)
      Removes the named feature from this set of features.
      Specified by:
      remove in interface FeatureSet
      Parameters:
      name - the name of the feature of interest
    • getString

      public String getString(String name)
      Convenience method that returns the named feature as a string.
      Specified by:
      getString in interface FeatureSet
      Parameters:
      name - the name of the feature
      Returns:
      the value associated with the name or null if the value is not found
      Throws:
      ClassCastException - if the associated value is not a String
    • getInt

      public int getInt(String name)
      Convenience method that returns the named feature as a int.
      Specified by:
      getInt in interface FeatureSet
      Parameters:
      name - the name of the feature
      Returns:
      the value associated with the name or null if the value is not found
      Throws:
      ClassCastException - if the associated value is not an int.
    • getFloat

      public float getFloat(String name)
      Convenience method that returns the named feature as a float.
      Specified by:
      getFloat in interface FeatureSet
      Parameters:
      name - the name of the feature
      Returns:
      the value associated with the name or null if the value is not found.
      Throws:
      ClassCastException - if the associated value is not a float
    • getObject

      public Object getObject(String name)
      Returns the named feature as an object.
      Specified by:
      getObject in interface FeatureSet
      Parameters:
      name - the name of the feature
      Returns:
      the value associated with the name or null if the value is not found
    • setInt

      public void setInt(String name, int value)
      Convenience method that sets the named feature as a int.
      Specified by:
      setInt in interface FeatureSet
      Parameters:
      name - the name of the feature
      value - the value of the feature
    • setFloat

      public void setFloat(String name, float value)
      Convenience method that sets the named feature as a float.
      Specified by:
      setFloat in interface FeatureSet
      Parameters:
      name - the name of the feature
      value - the value of the feature
    • setString

      public void setString(String name, String value)
      Convenience method that sets the named feature as a String.
      Specified by:
      setString in interface FeatureSet
      Parameters:
      name - the name of the feature
      value - the value of the feature
    • setObject

      public void setObject(String name, Object value)
      Sets the named feature.
      Specified by:
      setObject in interface FeatureSet
      Parameters:
      name - the name of the feature
      value - the value of the feature
    • dump

      public void dump(PrintWriter output, int pad, String title)
      Dumps the FeatureSet in textual form. The feature name is not included in the dump.
      Specified by:
      dump in interface Dumpable
      Specified by:
      dump in interface FeatureSet
      Parameters:
      output - where to send the formatted output
      pad - the padding
      title - the title
    • dump

      public void dump(PrintWriter output, int pad, String title, boolean showName)
      Dumps the FeatureSet in textual form.
      Parameters:
      output - where to send the formatted output
      pad - the padding
      title - the title
      showName - if true, include the feature name