Package adams.data.weka
Class WekaLabelIndex
- java.lang.Object
-
- adams.core.Index
-
- adams.core.AbstractDataBackedIndex<weka.core.Attribute>
-
- adams.data.weka.WekaLabelIndex
-
- All Implemented Interfaces:
CloneHandler<Index>,CustomDisplayStringProvider,ExampleProvider,HelpProvider,Serializable,Comparable<Index>
public class WekaLabelIndex extends AbstractDataBackedIndex<weka.core.Attribute>
ExtendedIndexclass that can use a label name to determine an index of a label as well.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WekaLabelIndex()Initializes with no index.WekaLabelIndex(String index)Initializes with the given index, but no maximum.WekaLabelIndex(String index, int max)Initializes with the given index and maximum.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WekaLabelIndexgetClone()Returns a clone of the object.StringgetExample()Returns the example.protected StringgetName(weka.core.Attribute data, int colIndex)Returns the label name at the specified index.protected intgetNumNames(weka.core.Attribute data)Returns the number of labels that the attribute has.-
Methods inherited from class adams.core.AbstractDataBackedIndex
clean, getData, getIndices, getIntIndex, getNames, initialize, isName, parse, replaceName, setData
-
Methods inherited from class adams.core.Index
compareTo, equals, getHelpDescription, getHelpIcon, getHelpTitle, getHelpURL, getIndex, getIntIndex, getMax, hashCode, hasIndex, isEmpty, isPlaceholder, parsePlaceholder, reset, setIndex, setMax, toDisplay, toString
-
-
-
-
Constructor Detail
-
WekaLabelIndex
public WekaLabelIndex()
Initializes with no index.
-
WekaLabelIndex
public WekaLabelIndex(String index)
Initializes with the given index, but no maximum.- Parameters:
index- the index to use
-
WekaLabelIndex
public WekaLabelIndex(String index, int max)
Initializes with the given index and maximum.- Parameters:
index- the index to usemax- the maximum of the 1-based index (e.g., use "10" to allow "1-10" or -1 for uninitialized)
-
-
Method Detail
-
getClone
public WekaLabelIndex getClone()
Returns a clone of the object.- Specified by:
getClonein interfaceCloneHandler<Index>- Overrides:
getClonein classAbstractDataBackedIndex<weka.core.Attribute>- Returns:
- the clone
-
getNumNames
protected int getNumNames(weka.core.Attribute data)
Returns the number of labels that the attribute has.- Specified by:
getNumNamesin classAbstractDataBackedIndex<weka.core.Attribute>- Parameters:
data- the attribute to retrieve the number of labels
-
getName
protected String getName(weka.core.Attribute data, int colIndex)
Returns the label name at the specified index.- Specified by:
getNamein classAbstractDataBackedIndex<weka.core.Attribute>- Parameters:
data- the dataset to usecolIndex- the label index- Returns:
- the label name
-
getExample
public String getExample()
Returns the example.- Specified by:
getExamplein interfaceExampleProvider- Overrides:
getExamplein classIndex- Returns:
- the example
-
-