org.knime.base.util.coordinate
Class PolicyStrategy

java.lang.Object
  extended by org.knime.base.util.coordinate.PolicyStrategy
Direct Known Subclasses:
AscendingNumericTickPolicyStrategy

public abstract class PolicyStrategy
extends Object

Abstract class for policy strategies.

Author:
Stephan Sellien, University of Konstanz

Constructor Summary
PolicyStrategy(String name)
          Creates a new PolicyStrategy.
 
Method Summary
abstract  double calculateMappedValue(DataCell domainValueCell, double absoluteLength, double minDomainValue, double maxDomainValue)
          Calculates the mapped value.
 double calculateMappedValue(DataCell domainValueCell, double absoluteLength, double minDomainValue, double maxDomainValue, double negativeInfinity, double positiveInfinity)
          Calculates the mapped value.
 String getDisplayName()
          Returns the name of this strategy.
protected  double getNegativeInfinity()
          Returns the value for negative infinity.
protected  double getPositiveInfinity()
          Returns the value for positive infinity.
abstract  CoordinateMapping[] getTickPositions(double absoluteLength, double minDomainValue, double maxDomainValue, double tickDistance)
          Calculates the mappings of the ticks according to the policy.
 CoordinateMapping[] getTickPositions(double absoluteLength, double minDomainValue, double maxDomainValue, double tickDistance, double negativeInfinity, double positiveInfinity)
          Calculates the mappings of the ticks according to the policy.
abstract  CoordinateMapping[] getTickPositions(int absoluteLength, int minDomainValue, int maxDomainValue, int tickDistance)
          Calculates the mappings of the ticks according to the policy.
 CoordinateMapping[] getTickPositions(int absoluteLength, int minDomainValue, int maxDomainValue, int tickDistance, double negativeInfinity, double positiveInfinity)
          Calculates the mappings of the ticks according to the policy.
protected  Set<DataValue> getValues()
          Returns the values.
 boolean isMappingAllowed()
          Returns whether mapping and relabeling by MappingMethods should be allowed for the ticks of this PolicyStrategy.
 void setValues(DataValue... values)
          Sets desired values for the policy strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolicyStrategy

public PolicyStrategy(String name)
Creates a new PolicyStrategy.

Parameters:
name - the name of this strategy. Name must not be null or empty!
Method Detail

setValues

public void setValues(DataValue... values)
Sets desired values for the policy strategy.

Parameters:
values - the values

getValues

protected Set<DataValue> getValues()
Returns the values.

Returns:
the values or null if there are none

calculateMappedValue

public abstract double calculateMappedValue(DataCell domainValueCell,
                                            double absoluteLength,
                                            double minDomainValue,
                                            double maxDomainValue)
Calculates the mapped value.

Parameters:
domainValueCell - the value to be mapped
absoluteLength - the absolute length
minDomainValue - the minimal domain value
maxDomainValue - the maximal domain value
Returns:
the mapped value

calculateMappedValue

public double calculateMappedValue(DataCell domainValueCell,
                                   double absoluteLength,
                                   double minDomainValue,
                                   double maxDomainValue,
                                   double negativeInfinity,
                                   double positiveInfinity)
Calculates the mapped value. Additionally, values for infinity can be changed.

Parameters:
domainValueCell - the value to be mapped
absoluteLength - the absolute length
minDomainValue - the minimal domain value
maxDomainValue - the maximal domain value
negativeInfinity - the value for negative infinity
positiveInfinity - the value for positive infinity
Returns:
the mapped value

getTickPositions

public abstract CoordinateMapping[] getTickPositions(double absoluteLength,
                                                     double minDomainValue,
                                                     double maxDomainValue,
                                                     double tickDistance)
Calculates the mappings of the ticks according to the policy.

Parameters:
absoluteLength - the absolute length
minDomainValue - the minimal domain value
maxDomainValue - the maximal domain value
tickDistance - the absolute distance between to ticks
Returns:
the mappings of the ticks.

getTickPositions

public CoordinateMapping[] getTickPositions(double absoluteLength,
                                            double minDomainValue,
                                            double maxDomainValue,
                                            double tickDistance,
                                            double negativeInfinity,
                                            double positiveInfinity)
Calculates the mappings of the ticks according to the policy. Additionally, values for infinity can be changed.

Parameters:
absoluteLength - the absolute length
minDomainValue - the minimal domain value
maxDomainValue - the maximal domain value
tickDistance - the absolute distance between to ticks
negativeInfinity - the value for negative infinity
positiveInfinity - the value for positive infinity
Returns:
the mappings of the ticks.

getTickPositions

public CoordinateMapping[] getTickPositions(int absoluteLength,
                                            int minDomainValue,
                                            int maxDomainValue,
                                            int tickDistance,
                                            double negativeInfinity,
                                            double positiveInfinity)
Calculates the mappings of the ticks according to the policy. Additionally, values for infinity can be changed.

Parameters:
absoluteLength - the absolute length
minDomainValue - the minimal domain value
maxDomainValue - the maximal domain value
tickDistance - the absolute distance between to ticks
negativeInfinity - the value for negative infinity
positiveInfinity - the value for positive infinity
Returns:
the mappings of the ticks.

getTickPositions

public abstract CoordinateMapping[] getTickPositions(int absoluteLength,
                                                     int minDomainValue,
                                                     int maxDomainValue,
                                                     int tickDistance)
Calculates the mappings of the ticks according to the policy.

Parameters:
absoluteLength - the absolute length
minDomainValue - the minimal domain value
maxDomainValue - the maximal domain value
tickDistance - the absolute distance between to ticks
Returns:
the mappings of the ticks.

getDisplayName

public String getDisplayName()
Returns the name of this strategy.

Returns:
the name

getPositiveInfinity

protected double getPositiveInfinity()
Returns the value for positive infinity.

Returns:
the value for positive infinity

getNegativeInfinity

protected double getNegativeInfinity()
Returns the value for negative infinity.

Returns:
the value for negative infinity.

isMappingAllowed

public boolean isMappingAllowed()
Returns whether mapping and relabeling by MappingMethods should be allowed for the ticks of this PolicyStrategy. The default value is true. An example for allowed mapping would be the a logarithmic scaling. An example where a mapping (logarithmic or square root) does not make sense is the percentage policy.

Returns:
true, if labels could be relabeled, false else.


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.