org.knime.core.data.property
Class SizeModelDouble

java.lang.Object
  extended by org.knime.core.data.property.SizeModelDouble
All Implemented Interfaces:
SizeHandler.SizeModel

public class SizeModelDouble
extends Object
implements SizeHandler.SizeModel

A SizeModel computing sizes of objects (rows) based on the double value of DataCell.

Author:
M. Berthold, University of Konstanz

Nested Class Summary
static class SizeModelDouble.Mapping
          Supported mapping methods.
 
Constructor Summary
SizeModelDouble(double min, double max)
          Create new SizeHandler based on double values and a given interval.
SizeModelDouble(double min, double max, double factor)
          Creates a new SizeHandler based on an interval defined by min and max and a magnification factor which defines the range onto the interval is mapped.
SizeModelDouble(double min, double max, double factor, SizeModelDouble.Mapping mapping)
          Creates a new SizeHandler based on an interval defined by min and max and a magnification factor which defines the range onto the interval is mapped.
 
Method Summary
 boolean equals(Object obj)
          
 double getFactor()
           
 SizeModelDouble.Mapping getMappingMethod()
           
 double getMaxValue()
           
 double getMinValue()
           
 double getSize(DataCell dc)
          Deprecated. use getSizeFactor(DataCell) instead.
 double getSizeFactor(DataCell dc)
          Computes the size based on the actual value of the provided cell, the interval, the scaling factor and the mapping method.
 int hashCode()
          
static SizeModelDouble load(ConfigRO config)
          Reads the size settings and return a new SizeModelDouble.
 void save(ConfigWO config)
          Saves min and max ranges to the given Config.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SizeModelDouble

public SizeModelDouble(double min,
                       double max)
Create new SizeHandler based on double values and a given interval.

Parameters:
min - minimum of domain
max - maximum of domain
Throws:
IllegalArgumentException - If min < max

SizeModelDouble

public SizeModelDouble(double min,
                       double max,
                       double factor)
Creates a new SizeHandler based on an interval defined by min and max and a magnification factor which defines the range onto the interval is mapped. Uses linear mapping.

Parameters:
min - minimum of the domain
max - maximum of the domain
factor - scaling factor for the mapping

SizeModelDouble

public SizeModelDouble(double min,
                       double max,
                       double factor,
                       SizeModelDouble.Mapping mapping)
Creates a new SizeHandler based on an interval defined by min and max and a magnification factor which defines the range onto the interval is mapped. Uses the provided mapping method.

Parameters:
min - minimum of the domain
max - maximum of the domain
factor - scaling factor for the mapping
mapping - the mapping method to use (linear, square root, logarithmic)
Method Detail

getSize

@Deprecated
public double getSize(DataCell dc)
Deprecated. use getSizeFactor(DataCell) instead.

Compute size based on actual value of this cell and the range which was defined during construction.

Specified by:
getSize in interface SizeHandler.SizeModel
Parameters:
dc - value to be used for size computation.
Returns:
size in percent or -1 if cell type invalid or out of range
See Also:
SizeHandler.getSize(DataCell)

getSizeFactor

public double getSizeFactor(DataCell dc)
Computes the size based on the actual value of the provided cell, the interval, the scaling factor and the mapping method. Factor will be larger or equal to one and with no maximum value. Indicates the scaling factor. The largest value should be displayed n times larger.

Specified by:
getSizeFactor in interface SizeHandler.SizeModel
Parameters:
dc - the attribute value to get the size factor for
Returns:
a double indicating the maginfication relative to the normal size used

getMinValue

public double getMinValue()
Returns:
minimum double value.

getMaxValue

public double getMaxValue()
Returns:
maximum double value.

getFactor

public double getFactor()
Returns:
the scaling factor

getMappingMethod

public SizeModelDouble.Mapping getMappingMethod()
Returns:
the mapping method

save

public void save(ConfigWO config)
Saves min and max ranges to the given Config.

Specified by:
save in interface SizeHandler.SizeModel
Parameters:
config - To write bounds into.
Throws:
NullPointerException - If the config is null.
See Also:
#save(ConfigWO)

load

public static SizeModelDouble load(ConfigRO config)
                            throws InvalidSettingsException
Reads the size settings and return a new SizeModelDouble.

Parameters:
config - Read min and max bound from.
Returns:
A new size model.
Throws:
InvalidSettingsException - If the bounds could not be read.
NullPointerException - If the config is null.

toString

public String toString()
Overrides:
toString in class Object
Returns:
String representation containing SizeModel type and min/max boundaries.

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


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.