Package weka.associations

# Class Item

java.lang.Object
weka.associations.Item

All Implemented Interfaces:
  `Serializable`, `Comparable<Item>`

Direct Known Subclasses:
  `NominalItem`, `NumericItem`

public abstract class Item extends Object implements Serializable, Comparable<Item>
Class that encapsulates information about an individual item. An item is a value of a nominal attribute, so this class has a backing Attribute.

Version:
  $Revision: 8034 $
Author:
  Mark Hall (mhall{[at]}pentaho{[dot]}com).
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Item(Attribute att)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compareTo(Item comp)`
  Ensures that items will be sorted in descending order of frequency.
  `void`
  `decreaseFrequency()`
  Decrement the frequency of this item.
  `void`
  `decreaseFrequency(int f)`
  Decrease the frequency of this item.
  `boolean`
  `equals(Object compareTo)`
  Equals.
  `Attribute`
  `getAttribute()`
  Get the attribute that this item originates from.
  `abstract String`
  `getComparisonAsString()`
  Get this item's comparison operator as a String.
  `int`
  `getFrequency()`
  Get the frequency of this item.
  `abstract String`
  `getItemValueAsString()`
  Get this item's value as a String.
  `int`
  `hashCode()`
  `void`
  `increaseFrequency()`
  Increment the frequency of this item.
  `void`
  `increaseFrequency(int f)`
  Increase the frequency of this item.
  `String`
  `toString()`
  A string representation of this item.
  `String`
  `toString(boolean freq)`
  A string representation of this item, (i.e.

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

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

- ## Constructor Details

  - ### Item

    public Item(Attribute att)

- ## Method Details

  - ### increaseFrequency

    public void increaseFrequency(int f)
    Increase the frequency of this item.
    Parameters:
      `f` - the amount to increase the frequency by.

  - ### decreaseFrequency

    public void decreaseFrequency(int f)
    Decrease the frequency of this item.
    Parameters:
      `f` - the amount by which to decrease the frequency.

  - ### increaseFrequency

    public void increaseFrequency()
    Increment the frequency of this item.

  - ### decreaseFrequency

    public void decreaseFrequency()
    Decrement the frequency of this item.

  - ### getFrequency

    public int getFrequency()
    Get the frequency of this item.
    Returns:
      the frequency.

  - ### getAttribute

    public Attribute getAttribute()
    Get the attribute that this item originates from.
    Returns:
      the corresponding attribute.

  - ### getItemValueAsString

    public abstract String getItemValueAsString()
    Get this item's value as a String.
    Returns:
      this item's value as a String.

  - ### getComparisonAsString

    public abstract String getComparisonAsString()
    Get this item's comparison operator as a String.
    Returns:
      this item's comparison operator as a String.

  - ### toString

    public String toString()
    A string representation of this item. (i.e. ).
    Overrides:
      `toString` in class `Object`
    Returns:
      a string representation of this item.

  - ### toString

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

  - ### compareTo

    public int compareTo(Item comp)
    Ensures that items will be sorted in descending order of frequency. Ties are ordered by attribute name.
    Specified by:
      `compareTo` in interface `Comparable<Item>`
    Parameters:
      `comp` - the Item to compare against.

  - ### equals

    public boolean equals(Object compareTo)
    Equals. Just compares attribute.
    Overrides:
      `equals` in class `Object`
    Returns:
      true if this Item is equal to the argument.

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`