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 Summary
ConstructorDescriptionAttributeLocator
(Instances data, int type) Initializes the AttributeLocator with the given data for the specified type of attribute.AttributeLocator
(Instances data, int type, int[] indices) initializes the AttributeLocator with the given data for the specified type of attribute.AttributeLocator
(Instances data, int type, int fromIndex, int toIndex) Initializes the AttributeLocator with the given data for the specified type of attribute. -
Method Summary
Modifier and TypeMethodDescriptionint
Compares this object with the specified object for order.boolean
Indicates whether some other object is "equal to" this one.int
getActualIndex
(int index) returns actual index in the Instances object.int[]
returns the indices that are allowed to check for the attribute typeint[]
Returns the indices of the attributes.getData()
returns the underlying datagetLocator
(int index) Returns the AttributeLocator at the given index.int[]
Returns the indices of the AttributeLocator objects.Returns the revision string.int
getType()
returns the type of attribute that is locatedtoString()
returns a string representation of this object
-
Constructor Details
-
AttributeLocator
Initializes the AttributeLocator with the given data for the specified type of attribute. Checks all attributes.- Parameters:
data
- the data to work ontype
- the type of attribute to locate
-
AttributeLocator
Initializes the AttributeLocator with the given data for the specified type of attribute. Checks only the given range.- Parameters:
data
- the data to work ontype
- the type of attribute to locatefromIndex
- the first index to inspect (including)toIndex
- the last index to check (including)
-
AttributeLocator
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 ontype
- the type of attribute to locateindices
- 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
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
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
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 interfaceComparable<AttributeLocator>
- Parameters:
o
- the object to compare with- Returns:
- -1 if less than, 0 if equal, +1 if greater than the given object
-
equals
Indicates whether some other object is "equal to" this one. Only type and indices are checked. -
toString
returns a string representation of this object -
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-