org.knime.base.node.viz.histogram.datamodel
Class FixedHistogramDataModel

java.lang.Object
  extended by org.knime.base.node.viz.histogram.datamodel.FixedHistogramDataModel

public class FixedHistogramDataModel
extends Object

This is the fixed data model implementation of the histogram which is created only once when the user executes a node.

Author:
Tobias Koetter, University of Konstanz

Constructor Summary
FixedHistogramDataModel(DataColumnSpec xColSpec, AggregationMethod aggrMethod, Collection<ColorColumn> aggrColumns, int noOfBins)
          Constructor for class HistogramDataModel.
 
Method Summary
 void addDataRow(RowKey id, Color rowColor, DataCell xCell, DataCell... aggrCells)
          Adds the given row values to the histogram.
 Collection<ColorColumn> getAggrColumns()
           
 AggregationMethod getAggrMethod()
           
 boolean getBinNominal()
           
 List<BinDataModel> getClonedBins()
           
 BinDataModel getClonedMissingValueBin()
           
 List<Color> getRowColors()
           
 String getXColumnName()
           
 DataColumnSpec getXColumnSpec()
           
static FixedHistogramDataModel loadFromFile(File directory, ExecutionMonitor exec)
           
 void save2File(File directory, ExecutionMonitor exec)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedHistogramDataModel

public FixedHistogramDataModel(DataColumnSpec xColSpec,
                               AggregationMethod aggrMethod,
                               Collection<ColorColumn> aggrColumns,
                               int noOfBins)
Constructor for class HistogramDataModel.

Parameters:
xColSpec - the column specification of the bin column
aggrMethod - the AggregationMethod to use
aggrColumns - the aggregation columns
noOfBins - the number of bins to create
Method Detail

addDataRow

public void addDataRow(RowKey id,
                       Color rowColor,
                       DataCell xCell,
                       DataCell... aggrCells)
Adds the given row values to the histogram.

Parameters:
id - the row key of this row
rowColor - the color of this row
xCell - the x value
aggrCells - the aggregation values

getXColumnName

public String getXColumnName()
Returns:
the x column name

getXColumnSpec

public DataColumnSpec getXColumnSpec()
Returns:
the x column specification

getAggrColumns

public Collection<ColorColumn> getAggrColumns()
Returns:
the columns to use for aggregation. THIS IS AN UNMODIFIABLE Collection!

getAggrMethod

public AggregationMethod getAggrMethod()
Returns:
the aggrMethod to use

getRowColors

public List<Color> getRowColors()
Returns:
all available element colors. This is the color the user has set for one attribute in the Color Manager node.

getBinNominal

public boolean getBinNominal()
Returns:
true if the bins are nominal

getClonedBins

public List<BinDataModel> getClonedBins()
Returns:
a copy of all bins

getClonedMissingValueBin

public BinDataModel getClonedMissingValueBin()
Returns:
a copy of the bin with all rows where the x value was missing

save2File

public void save2File(File directory,
                      ExecutionMonitor exec)
               throws IOException,
                      CanceledExecutionException
Parameters:
directory - the directory to write to
exec - the ExecutionMonitor to provide progress messages
Throws:
IOException - if a file exception occurs
CanceledExecutionException - if the operation is canceled

loadFromFile

public static FixedHistogramDataModel loadFromFile(File directory,
                                                   ExecutionMonitor exec)
                                            throws InvalidSettingsException,
                                                   IOException,
                                                   CanceledExecutionException
Parameters:
directory - the directory to write to
exec - the ExecutionMonitor to provide progress messages
Returns:
the histogram data model
Throws:
InvalidSettingsException - if the x column specification wasn't valid
IOException - if a file exception occurs
CanceledExecutionException - if the operation is canceled


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.