com.rapidminer.datatable
Class DataTableSymmetricalMatrixAdapter

java.lang.Object
  extended by com.rapidminer.datatable.AbstractDataTable
      extended by com.rapidminer.datatable.DataTableSymmetricalMatrixAdapter
All Implemented Interfaces:
DataTable, Reportable, Tableable, java.lang.Iterable<DataTableRow>

public class DataTableSymmetricalMatrixAdapter
extends AbstractDataTable

This class can be used to use a symmetrical matrix as data table. The data is directly read from the symmetrical matrix (e.g. a correlation matrix) instead of building a copy. Please note that the method for adding new rows is not supported by this type of data tables.

Author:
Ingo Mierswa

Constructor Summary
DataTableSymmetricalMatrixAdapter(NumericalMatrix matrix, java.lang.String name, java.lang.String[] columnNames)
           
 
Method Summary
 void add(DataTableRow row)
          Adds the given DataTableRow to the table.
 int getColumnIndex(java.lang.String name)
          Returns the column index of the column with the given name.
 java.lang.String getColumnName(int i)
          Returns the name of the i-th column.
 double getColumnWeight(int column)
          Returns the weight of the column or Double.NaN if no weight is available.
 int getNumberOfColumns()
          Returns the total number of columns.
 int getNumberOfRows()
          Returns the total number of rows.
 int getNumberOfSpecialColumns()
          Returns the total number of special columns.
 int getNumberOfValues(int column)
          Returns the number of different values for the i-th column.
 DataTableRow getRow(int index)
          Returns the data table row with the given index.
 boolean isDate(int index)
          Indicates if the column with the given index is nominal.
 boolean isDateTime(int index)
          Indicates if the column with the given index is nominal.
 boolean isNominal(int index)
          Indicates if the column with the given index is nominal.
 boolean isNumerical(int index)
          Indicates if the column with the given index is nominal.
 boolean isSpecial(int index)
          Returns true if this column is a special column which might usually not be used for some plotters, for example weights or labels.
 boolean isSupportingColumnWeights()
          Returns true if this data table is supporting column weights.
 boolean isTime(int index)
          Indicates if the column with the given index is nominal.
 java.util.Iterator<DataTableRow> iterator()
          Returns an iterator over all DataTableRows.
 java.lang.String mapIndex(int column, int value)
          If a column is nominal, the index value must be mapped to the nominal value by this method.
 int mapString(int column, java.lang.String value)
          Please note that this method does not map new strings but is only able to deliver strings which where already known during construction.
 DataTable sample(int newSize)
          Not implemented!!!
 
Methods inherited from class com.rapidminer.datatable.AbstractDataTable
addDataTableListener, containsMissingValues, finishReporting, fireEvent, getCell, getColumnNames, getColumnNumber, getName, getRowNumber, getSelectionCount, getValueAsString, isDeselected, isFirstColumnHeader, isFirstLineHeader, prepareReporting, removeDataTableListener, setName, setSelection, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataTableSymmetricalMatrixAdapter

public DataTableSymmetricalMatrixAdapter(NumericalMatrix matrix,
                                         java.lang.String name,
                                         java.lang.String[] columnNames)
Method Detail

getNumberOfSpecialColumns

public int getNumberOfSpecialColumns()
Description copied from interface: DataTable
Returns the total number of special columns. Please note that these columns do not need to be in an ordered sequence. In order to make sure that a column is a special column the method DataTable.isSpecial(int) should be used.


isSpecial

public boolean isSpecial(int index)
Description copied from interface: DataTable
Returns true if this column is a special column which might usually not be used for some plotters, for example weights or labels.


isNominal

public boolean isNominal(int index)
Description copied from interface: DataTable
Indicates if the column with the given index is nominal. For numerical or date columns, the value false should be returned.


isDate

public boolean isDate(int index)
Description copied from interface: DataTable
Indicates if the column with the given index is nominal. For numerical or date columns, the value false should be returned.


isTime

public boolean isTime(int index)
Description copied from interface: DataTable
Indicates if the column with the given index is nominal. For numerical or date columns, the value false should be returned.


isDateTime

public boolean isDateTime(int index)
Description copied from interface: DataTable
Indicates if the column with the given index is nominal. For numerical or date columns, the value false should be returned.


isNumerical

public boolean isNumerical(int index)
Description copied from interface: DataTable
Indicates if the column with the given index is nominal. For numerical or date columns, the value false should be returned.


mapIndex

public java.lang.String mapIndex(int column,
                                 int value)
Description copied from interface: DataTable
If a column is nominal, the index value must be mapped to the nominal value by this method. If the given column is not nominal, this method might throw a NullPointerException.


mapString

public int mapString(int column,
                     java.lang.String value)
Please note that this method does not map new strings but is only able to deliver strings which where already known during construction.


getNumberOfValues

public int getNumberOfValues(int column)
Description copied from interface: DataTable
Returns the number of different values for the i-th column. Might return -1 or throw an exception if the specific column is not nominal.


getColumnName

public java.lang.String getColumnName(int i)
Description copied from interface: DataTable
Returns the name of the i-th column.


getColumnIndex

public int getColumnIndex(java.lang.String name)
Description copied from interface: DataTable
Returns the column index of the column with the given name.


isSupportingColumnWeights

public boolean isSupportingColumnWeights()
Description copied from interface: DataTable
Returns true if this data table is supporting column weights.


getColumnWeight

public double getColumnWeight(int column)
Description copied from interface: DataTable
Returns the weight of the column or Double.NaN if no weight is available.


getNumberOfColumns

public int getNumberOfColumns()
Description copied from interface: DataTable
Returns the total number of columns.


add

public void add(DataTableRow row)
Description copied from interface: DataTable
Adds the given DataTableRow to the table.


getRow

public DataTableRow getRow(int index)
Description copied from interface: DataTable
Returns the data table row with the given index. Please note that this method is not guaranteed to be efficiently implemented. If you want to scan the complete data table you should use the iterator() method instead.


iterator

public java.util.Iterator<DataTableRow> iterator()
Description copied from interface: DataTable
Returns an iterator over all DataTableRows.


getNumberOfRows

public int getNumberOfRows()
Description copied from interface: DataTable
Returns the total number of rows.


sample

public DataTable sample(int newSize)
Not implemented!!! Please use this class only for plotting purposes if you can ensure that the number of columns / rows is small.



Copyright © 2001-2009 by Rapid-I