weka.associations

## Class NominalItem

- java.lang.Object
- - weka.associations.Item
  - - weka.associations.NominalItem

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Item>
  Direct Known Subclasses:
    BinaryItem

      public class NominalItem
      extends Item
      implements java.io.Serializable

  Class that encapsulates a nominal item.
  Version:
    $Revision: 8034 $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NominalItem(Attribute att, int valueIndex)` Constructs a new NominalItem.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object compareTo)` Equals.
    `java.lang.String` | `getComparisonAsString()` Get this item's comparison operator as a String.
    `java.lang.String` | `getItemValueAsString()` Get this item's value as a String.
    `int` | `getValueIndex()` Get the value index for this item.
    `java.lang.String` | `toString(boolean freq)` A string representation of this item, (i.e.

    - ### Methods inherited from class weka.associations.Item

      `compareTo, decreaseFrequency, decreaseFrequency, getAttribute, getFrequency, hashCode, increaseFrequency, increaseFrequency, toString`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### NominalItem

          public NominalItem(Attribute att,
                             int valueIndex)
                      throws java.lang.Exception

      Constructs a new NominalItem.
      Parameters:
        `att` - the attribute that backs the item.
        `valueIndex` - the index of the value for this item.
      Throws:
        `java.lang.Exception` - if the NominalItem can't be constructed.

  - ### Method Detail

    - #### getValueIndex

          public int getValueIndex()

      Get the value index for this item.
      Returns:
        the value index.

    - #### getItemValueAsString

          public java.lang.String getItemValueAsString()

      Get this item's value as a String.
      Specified by:
        `getItemValueAsString` in class `Item`
      Returns:
        this item's value as a String.

    - #### getComparisonAsString

          public java.lang.String getComparisonAsString()

      Get this item's comparison operator as a String.
      Specified by:
        `getComparisonAsString` in class `Item`
      Returns:
        this item's comparison operator as a String.

    - #### toString

          public java.lang.String toString(boolean freq)

      A string representation of this item, (i.e. ). This default implementation just prints the attribute name and (optionally) frequency information.
      Overrides:
        `toString` in class `Item`
      Parameters:
        `freq` - true if the frequency should be included.
      Returns:
        a string representation of this item.

    - #### equals

          public boolean equals(java.lang.Object compareTo)

      Equals. Just compares attribute and valueIndex.
      Overrides:
        `equals` in class `Item`
      Returns:
        true if this NominalItem is equal to the argument.