Package weka.core

Class AttributeLocator

java.lang.Object
weka.core.AttributeLocator
All Implemented Interfaces:
Serializable, Comparable<AttributeLocator>, RevisionHandler
Direct Known Subclasses:
RelationalLocator, StringLocator

public class AttributeLocator extends Object implements Serializable, Comparable<AttributeLocator>, RevisionHandler
This class locates and records the indices of a certain type of attributes, recursively in case of Relational attributes.
Version:
$Revision: 10649 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
  • Constructor Details

    • AttributeLocator

      public AttributeLocator(Instances data, int type)
      Initializes the AttributeLocator with the given data for the specified type of attribute. Checks all attributes.
      Parameters:
      data - the data to work on
      type - the type of attribute to locate
    • AttributeLocator

      public AttributeLocator(Instances data, int type, int fromIndex, int toIndex)
      Initializes the AttributeLocator with the given data for the specified type of attribute. Checks only the given range.
      Parameters:
      data - the data to work on
      type - the type of attribute to locate
      fromIndex - the first index to inspect (including)
      toIndex - the last index to check (including)
    • AttributeLocator

      public AttributeLocator(Instances data, int type, int[] indices)
      initializes the AttributeLocator with the given data for the specified type of attribute. Checks only the given attribute indices.
      Parameters:
      data - the data to work on
      type - the type of attribute to locate
      indices - the attribute indices to check
  • Method Details

    • getType

      public int getType()
      returns the type of attribute that is located
      Returns:
      the type of attribute
    • getAllowedIndices

      public int[] getAllowedIndices()
      returns the indices that are allowed to check for the attribute type
      Returns:
      the indices that are checked for the attribute type
    • getData

      public Instances getData()
      returns the underlying data
      Returns:
      the underlying Instances object
    • getActualIndex

      public int getActualIndex(int index)
      returns actual index in the Instances object.
      Parameters:
      index - the index in the m_AllowedIndices array
      Returns:
      the actual index in the instances object
    • getAttributeIndices

      public int[] getAttributeIndices()
      Returns the indices of the attributes. These indices are referring to the m_AllowedIndices array, not the actual indices in the Instances object.
      Returns:
      the indices of the attributes
      See Also:
    • getLocatorIndices

      public int[] getLocatorIndices()
      Returns the indices of the AttributeLocator objects. These indices are referring to the m_AllowedIndices array, not the actual indices in the Instances object.
      Returns:
      the indices of the AttributeLocator objects
      See Also:
    • getLocator

      public AttributeLocator getLocator(int index)
      Returns the AttributeLocator at the given index. This index refers to the index of the m_AllowedIndices array, not the actual Instances object.
      Parameters:
      index - the index of the locator to retrieve
      Returns:
      the AttributeLocator at the given index
    • compareTo

      public int compareTo(AttributeLocator o)
      Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. Only type and indices are checked.
      Specified by:
      compareTo in interface Comparable<AttributeLocator>
      Parameters:
      o - the object to compare with
      Returns:
      -1 if less than, 0 if equal, +1 if greater than the given object
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. Only type and indices are checked.
      Overrides:
      equals in class Object
      Parameters:
      o - the AttributeLocator to check for equality
      Returns:
      true if the AttributeLocators have the same type and indices
    • toString

      public String toString()
      returns a string representation of this object
      Overrides:
      toString in class Object
      Returns:
      a string representation
    • getRevision

      public String getRevision()
      Returns the revision string.
      Specified by:
      getRevision in interface RevisionHandler
      Returns:
      the revision