weka.filters.unsupervised.attribute

## Class AddUserFields.AttributeSpec

- java.lang.Object
- - weka.filters.unsupervised.attribute.AddUserFields.AttributeSpec

- All Implemented Interfaces:
    java.io.Serializable
  Enclosing class:
    AddUserFields

      public static class AddUserFields.AttributeSpec
      extends java.lang.Object
      implements java.io.Serializable

  Inner class encapsulating a new user-specified attribute to create.
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AttributeSpec()` Default constructor
    `AttributeSpec(java.lang.String spec)` Constructor that takes an attribute specification in internal format

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getDateFormat()` Get the date formatting string (if any)
    `java.util.Date` | `getDateValue()` Get the value of the attribute as a date or null if the attribute isn't of type date.
    `java.lang.String` | `getName()` Get the name of the new attribute
    `java.lang.String` | `getNominalOrStringValue()` Get the value of the attribute as a string (nominal and string attribute) or null if the attribute is not nominal or string
    `double` | `getNumericValue()` Get the value of the attribute as a number or Utils.missingValue() if the attribute is not numeric.
    `java.lang.String` | `getResolvedName()` Get the name of the attribute after substituting any environment variables
    `java.lang.String` | `getResolvedType()` Get the type of the attribute after substituting any environment variables
    `java.lang.String` | `getResolvedValue()` Get the value of the attribute after substituting any environment variables
    `java.lang.String` | `getType()` Get the type of the new attribute
    `java.lang.String` | `getValue()` Get the value of the new attribute.
    `void` | `init(Environment env)` Initialize this attribute spec by resolving any environment variables and setting up the date format (if necessary)
    `void` | `setName(java.lang.String name)` Set the name of the new attribute
    `void` | `setType(java.lang.String type)` Set the type of the new attribute
    `void` | `setValue(java.lang.String value)` Set the value of the new attribute.
    `java.lang.String` | `toString()` Return a nicely formatted string for display
    `java.lang.String` | `toStringInternal()`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AttributeSpec

          public AttributeSpec()

      Default constructor

    - #### AttributeSpec

          public AttributeSpec(java.lang.String spec)

      Constructor that takes an attribute specification in internal format
      Parameters:
        `spec` - the attribute spec to use

  - ### Method Detail

    - #### setName

          public void setName(java.lang.String name)

      Set the name of the new attribute
      Parameters:
        `name` - the name of the new attribute

    - #### getName

          public java.lang.String getName()

      Get the name of the new attribute
      Returns:
        the name of the new attribute

    - #### setType

          public void setType(java.lang.String type)

      Set the type of the new attribute
      Parameters:
        `type` - the type of the new attribute

    - #### getType

          public java.lang.String getType()

      Get the type of the new attribute
      Returns:
        the type of the new attribute

    - #### setValue

          public void setValue(java.lang.String value)

      Set the value of the new attribute. Date attributes can assume a supplied date value (parseable by either the default date format or a user specified one) or the current time stamp if the user specifies the special string "now".
      Parameters:
        `value` - the value of the new attribute

    - #### getValue

          public java.lang.String getValue()

      Get the value of the new attribute. Date attributes can assume a supplied date value (parseable by either the default date format or a user specified one) or the current time stamp if the user specifies the special string "now".
      Returns:
        the value of the new attribute

    - #### getResolvedName

          public java.lang.String getResolvedName()

      Get the name of the attribute after substituting any environment variables
      Returns:
        the name of the attribute after environment variables have been substituted

    - #### getResolvedValue

          public java.lang.String getResolvedValue()

      Get the value of the attribute after substituting any environment variables
      Returns:
        the value of the attribute after environment variables have been substituted

    - #### getResolvedType

          public java.lang.String getResolvedType()

      Get the type of the attribute after substituting any environment variables
      Returns:
        the tyep of the attribute after environment variables have been substituted

    - #### getDateFormat

          public java.lang.String getDateFormat()

      Get the date formatting string (if any)
      Returns:
        the date formatting string

    - #### getDateValue

          public java.util.Date getDateValue()

      Get the value of the attribute as a date or null if the attribute isn't of type date.
      Returns:
        the value as a date

    - #### getNumericValue

          public double getNumericValue()

      Get the value of the attribute as a number or Utils.missingValue() if the attribute is not numeric.
      Returns:
        the value of the attribute as a number

    - #### getNominalOrStringValue

          public java.lang.String getNominalOrStringValue()

      Get the value of the attribute as a string (nominal and string attribute) or null if the attribute is not nominal or string
      Returns:
        the value of the attribute as a string

    - #### init

          public void init(Environment env)

      Initialize this attribute spec by resolving any environment variables and setting up the date format (if necessary)
      Parameters:
        `env` - environment variables to use

    - #### toString

          public java.lang.String toString()

      Return a nicely formatted string for display
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a textual description

    - #### toStringInternal

          public java.lang.String toStringInternal()