Documentation of 'smile.data.StringAttribute' Java class
StringAttribute
smile.data

Class StringAttribute

  • All Implemented Interfaces:
    java.io.Serializable


    public class StringAttribute
    extends Attribute
    String attribute. String attributes may contain arbitrary textual values. Value 0 is reserved for unknown word.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      StringAttribute(java.lang.String name)
      Constructor.
      StringAttribute(java.lang.String name, double weight)
      Constructor.
      StringAttribute(java.lang.String name, java.lang.String description, double weight)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean isOpen()
      Returns true if the string values of the nominal attribute is a open set.
      void setOpen(boolean open)
      Sets if the string values of the nominal attribute is a open set.
      java.lang.String toString(double x)
      Returns the string representation of a double value of this attribute.
      double valueOf(java.lang.String s)
      Returns the double value of a string of this attribute.
      java.util.List<java.lang.String> values()
      Returns the list of string values of this attribute.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • StringAttribute

        public StringAttribute(java.lang.String name)
        Constructor.
        Parameters:
        name - the name of attribute.
      • StringAttribute

        public StringAttribute(java.lang.String name,
                               double weight)
        Constructor.
        Parameters:
        name - the name of attribute.
      • StringAttribute

        public StringAttribute(java.lang.String name,
                               java.lang.String description,
                               double weight)
        Constructor.
        Parameters:
        name - the name of attribute.
        description - the detailed description of attribute.
    • Method Detail

      • values

        public java.util.List<java.lang.String> values()
        Returns the list of string values of this attribute.
        Returns:
        the list of string values of this attribute
      • isOpen

        public boolean isOpen()
        Returns true if the string values of the nominal attribute is a open set. The new string values will be added into the attribute when calling the method valueOf(String).
        Returns:
        true if the string values of the nominal attribute is a open set.
      • setOpen

        public void setOpen(boolean open)
        Sets if the string values of the nominal attribute is a open set.
        Parameters:
        open - true if the string values of the nominal attribute is a open set.
      • valueOf

        public double valueOf(java.lang.String s)
                       throws java.text.ParseException
        Description copied from class: Attribute
        Returns the double value of a string of this attribute.
        Specified by:
        valueOf in class Attribute
        Parameters:
        s - a string value of this attribute.
        Throws:
        java.text.ParseException
      • toString

        public java.lang.String toString(double x)
        Description copied from class: Attribute
        Returns the string representation of a double value of this attribute.
        Specified by:
        toString in class Attribute
        Parameters:
        x - a double value of this attribute. NaN means missing value.
        Returns:
        the string representation of x. For nominal, date and string attributes, null will be returned for missing values. For numeric attributes, "NaN" will be returned for missing values.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.