org.knime.base.util.coordinate
Class NumericCoordinate

java.lang.Object
  extended by org.knime.base.util.coordinate.Coordinate
      extended by org.knime.base.util.coordinate.NumericCoordinate
Direct Known Subclasses:
DoubleCoordinate, IntegerCoordinate

public abstract class NumericCoordinate
extends Coordinate

The abstract class which should be implemented by all coordinates which map numeric values.

Author:
Tobias Koetter, University of Konstanz, Stephan Sellien, University of Konstanz
See Also:
DoubleCoordinate

Field Summary
 
Fields inherited from class org.knime.base.util.coordinate.Coordinate
DEFAULT_ABSOLUTE_TICK_DIST
 
Constructor Summary
NumericCoordinate(DataColumnSpec dataColumnSpec)
          Constructor for class NumericCoordinate.
 
Method Summary
 void addDesiredValues(DataValue... values)
          Adds a value which should have a tick.
protected abstract  double calculateMappedValueInternal(DataCell domainValueCell, double absolutLength)
          Calculates a numeric mapping assuming a DoubleCell.
 DataValue[] getDesiredValues()
          Returns the desired values.
 double getMaxDomainValue()
           
 double getMinDomainValue()
           
 double getNegativeInfinity()
          Returns the value for negative infinity after mapping.
 double getPositiveInfinity()
          Returns the value for positive infinity after mapping.
protected abstract  CoordinateMapping[] getTickPositionsInternal(double absolutLength)
          Returns an array with the positions of all ticks and their corresponding domain values given an absolute length.
protected  CoordinateMapping[] getTickPositionsWithLabels(double absolutLength)
          Returns an array with the positions of all ticks and their corresponding domain values given an absolute length.
 double getUnusedDistBetweenTicks(double absoluteLength)
          A numeric coordinate does not has a unused distance range.
abstract  boolean isMaxDomainValueSet()
           
abstract  boolean isMinDomainValueSet()
           
 boolean isNominal()
          Whether this coordinate is a nominal one.
 void setMaxDomainValue(double value)
          Sets the upper domain value.
 void setMinDomainValue(double value)
          Sets the lower domain value.
 
Methods inherited from class org.knime.base.util.coordinate.Coordinate
addCoordinateFactory, addMappingMethod, addPolicy, applyMappingMethod, calculateMappedValue, calculateMappedValue, clearDesiredValues, createCoordinate, getActiveMappingMethod, getCompatibleMappingMethods, getCompatiblePolicies, getCurrentPolicy, getDataColumnSpec, getDesiredValuesSet, getDomain, getMappingMethod, getPolicyStategy, getTickPositions, getTickPositions, setActiveMappingMethod, setPolicy, setPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumericCoordinate

NumericCoordinate(DataColumnSpec dataColumnSpec)
Constructor for class NumericCoordinate.

Parameters:
dataColumnSpec - the specification of the coordinate column
Method Detail

getTickPositionsInternal

protected abstract CoordinateMapping[] getTickPositionsInternal(double absolutLength)
Returns an array with the positions of all ticks and their corresponding domain values given an absolute length. The pre-specified tick policy also influences the tick positions, e.g. ascending or descending.

Parameters:
absolutLength - the absolute length the domain is mapped on
Returns:
the mapping of tick positions and corresponding domain values

getTickPositionsWithLabels

protected CoordinateMapping[] getTickPositionsWithLabels(double absolutLength)
Returns an array with the positions of all ticks and their corresponding domain values given an absolute length. The pre-specified tick policy also influences the tick positions, e.g. ascending or descending.

Specified by:
getTickPositionsWithLabels in class Coordinate
Parameters:
absolutLength - the absolute length the domain is mapped on
Returns:
the mapping of tick positions and corresponding domain values

calculateMappedValueInternal

protected abstract double calculateMappedValueInternal(DataCell domainValueCell,
                                                       double absolutLength)
Calculates a numeric mapping assuming a DoubleCell. Returns the mapping of a domain value for this coordinate axis. The mapping is done according to the given absolute length.

The value is not the position on the screen. Since the java coordinate system is upside down simply subtract the returned value from the screen height to calculate the screen position.

Specified by:
calculateMappedValueInternal in class Coordinate
Parameters:
domainValueCell - the data cell with the domain value to map
absolutLength - the absolute length on which the domain value is mapped on
Returns:
the mapped value

isNominal

public boolean isNominal()
Whether this coordinate is a nominal one. Nominal coordinates must be treated differently in some cases, i.e. when rendering in a scatterplot nominal values are very likely to be drawn above each other which requires jittering.

Specified by:
isNominal in class Coordinate
Returns:
true, if this coordinate is a nominal one

getUnusedDistBetweenTicks

public double getUnusedDistBetweenTicks(double absoluteLength)
A numeric coordinate does not has a unused distance range.

Specified by:
getUnusedDistBetweenTicks in class Coordinate
Parameters:
absoluteLength - the absolute length
Returns:
0
See Also:
#getUnusedDistBetweenTicks(double)

isMinDomainValueSet

public abstract boolean isMinDomainValueSet()
Returns:
true if the lower domain range is set properly

isMaxDomainValueSet

public abstract boolean isMaxDomainValueSet()
Returns:
true if the upper domain range is set properly

setMinDomainValue

public void setMinDomainValue(double value)
Sets the lower domain value.

Parameters:
value - the lower value

setMaxDomainValue

public void setMaxDomainValue(double value)
Sets the upper domain value.

Parameters:
value - the upper value

getMaxDomainValue

public final double getMaxDomainValue()
Returns:
Returns the maxDomainValue.

getPositiveInfinity

public double getPositiveInfinity()
Returns the value for positive infinity after mapping. Necessary to recognize infinity after scaling e.g..

Overrides:
getPositiveInfinity in class Coordinate
Returns:
the value for positive infinity.

getNegativeInfinity

public double getNegativeInfinity()
Returns the value for negative infinity after mapping. Necessary to recognize infinity after scaling e.g..

Overrides:
getNegativeInfinity in class Coordinate
Returns:
the value for negative infinity.

getMinDomainValue

public final double getMinDomainValue()
Returns:
Returns the minDomainValue.

addDesiredValues

public void addDesiredValues(DataValue... values)
Adds a value which should have a tick. Only double values are accepted!

Specified by:
addDesiredValues in class Coordinate
Parameters:
values - the desired value

getDesiredValues

public DataValue[] getDesiredValues()
Returns the desired values.

Overrides:
getDesiredValues in class Coordinate
Returns:
the desired values as array or null, if not set


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.