adams.gui.visualization.instance
Class InstanceComparePanel.DatasetIndexer

java.lang.Object
  extended by adams.gui.visualization.instance.InstanceComparePanel.DatasetIndexer
All Implemented Interfaces:
Serializable
Enclosing class:
InstanceComparePanel

public static class InstanceComparePanel.DatasetIndexer
extends Object
implements Serializable

Helper class for indexing the rows of a dataset.

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
protected  Index m_AttributeIndex
          the attribute to index.
protected  weka.core.Instances m_Dataset
          the underlying dataset.
protected  TreeMap<String,Integer> m_Index
          the index.
protected  Boolean m_IsString
          whether the attribute is numeric or string/nominal.
protected  Range m_Range
          the range of attributes to use.
protected  weka.filters.unsupervised.attribute.Remove m_Remove
          the remove filter for trimming the range of attributes to return.
static int MAX_DECIMAL
          the maximum number of decimals after the decimal point to use.
 
Constructor Summary
InstanceComparePanel.DatasetIndexer()
          Initializes the indexer.
 
Method Summary
 String getAttributeIndex()
          Returns the index of the attribute to use for indexing.
 weka.core.Instances getDataset()
          Returns the dataset to index.
 TreeMap<String,Integer> getIndex()
          Returns the index, generates it if necessary.
 String getRange()
          Returns the range of attributes to use.
 Instance getRow(String row)
          Returns the Instance for the row.
 List<String> getRows()
          Returns a list of row IDs.
 boolean hasAttributeIndex()
          Checks whether an attribute index has been set.
protected  void initialize()
          Initializes the indexer, if necessary.
 boolean isString()
          Returns whether the sort index is nominal/string or numeric.
protected  void reset()
          Invalidates the indexer.
 void setAttributeIndex(String value)
          Sets the index of the attribute to use for indexing.
 void setDataset(weka.core.Instances value)
          Sets the dataset to index.
 void setRange(String value)
          Sets the range of attributes to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DECIMAL

public static final int MAX_DECIMAL
the maximum number of decimals after the decimal point to use.

See Also:
Constant Field Values

m_Dataset

protected weka.core.Instances m_Dataset
the underlying dataset.


m_AttributeIndex

protected Index m_AttributeIndex
the attribute to index.


m_Range

protected Range m_Range
the range of attributes to use.


m_Index

protected TreeMap<String,Integer> m_Index
the index.


m_IsString

protected Boolean m_IsString
whether the attribute is numeric or string/nominal.


m_Remove

protected weka.filters.unsupervised.attribute.Remove m_Remove
the remove filter for trimming the range of attributes to return.

Constructor Detail

InstanceComparePanel.DatasetIndexer

public InstanceComparePanel.DatasetIndexer()
Initializes the indexer.

Method Detail

reset

protected void reset()
Invalidates the indexer.


setDataset

public void setDataset(weka.core.Instances value)
Sets the dataset to index.

Parameters:
value - the dataset

getDataset

public weka.core.Instances getDataset()
Returns the dataset to index.

Returns:
the dataset

hasAttributeIndex

public boolean hasAttributeIndex()
Checks whether an attribute index has been set.

Returns:
true if an attribute index has been set

setAttributeIndex

public void setAttributeIndex(String value)
Sets the index of the attribute to use for indexing.

Parameters:
value - the index

getAttributeIndex

public String getAttributeIndex()
Returns the index of the attribute to use for indexing.

Returns:
the index

setRange

public void setRange(String value)
Sets the range of attributes to use.

Parameters:
value - the range

getRange

public String getRange()
Returns the range of attributes to use.

Returns:
the range

initialize

protected void initialize()
Initializes the indexer, if necessary.


isString

public boolean isString()
Returns whether the sort index is nominal/string or numeric.

Returns:
true if string/nominal

getIndex

public TreeMap<String,Integer> getIndex()
Returns the index, generates it if necessary.

Returns:
the generated index

getRows

public List<String> getRows()
Returns a list of row IDs.

Returns:
the available IDs

getRow

public Instance getRow(String row)
Returns the Instance for the row.

Parameters:
row - the row to retrieve
Returns:
the row or null if not found or failed to filter


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.