DESY ACOP Beans Home

com.cosylab.gui.components.range2
Interface Range

All Known Implementing Classes:
LinearRange, LogarithmicRange

public interface Range

This interface is a definition of range, a pair of two values denoting minimum and maximum. Range can be interpreted as a function of two parameters defined between minimum and maximum.

Two operations are defined on this range, conversion from absolute value to relative and vice-versa. Absolute values are of the same scale as minimum and maximum, relative values are defined as an interval between 0 and 1, where toRelative(getMinimum()) returns 0 and toRelative(getMaximum()) returns 1.

Additionally, each range provides TickCollector, which generates information used when rendering scale ticks.

Version:
$id$
Author:
Ales Pucelj

Method Summary
 TickCalculator getDefaultTickCalculator()
          Returns the default TickCaluclator employed by this Range.
 double toAbsolute(double relative, RangedValue ranged)
          Converts relative value (in 0 to 1 range) to absolute value.
 double toRelative(double absolute, RangedValue ranged)
          Converts absolute value (in getMinimum() to getMaximum() range) to relative value (0 to 1 range).
 double validate(double value)
          Checks the value for acceptability.
 

Method Detail

toAbsolute

double toAbsolute(double relative,
                  RangedValue ranged)
Converts relative value (in 0 to 1 range) to absolute value.

These conditions must be true:

This method does not need to return correct result for values outside the 0 to 1 range.

Parameters:
relative - value to convert to absolute.
Returns:
Absolute value.

toRelative

double toRelative(double absolute,
                  RangedValue ranged)
Converts absolute value (in getMinimum() to getMaximum() range) to relative value (0 to 1 range).

These conditions must be true:

Parameters:
absolute - value to convert to relative.
Returns:
relative value.

validate

double validate(double value)
Checks the value for acceptability. This is acceptance test for each and every value that is used with this range. Result will be adjusted value of the parameter.

For some scales i.e. logarithmic, no value can be set below certain value (0.0 in case of logarithmic). This method will ensure, that whenever incorrect value is passed, it returns a value that is acceptable. In case of logarithmic range, return value will never be less than 0.0.

Parameters:
value - to test.
Returns:
acceptable value.

getDefaultTickCalculator

TickCalculator getDefaultTickCalculator()
Returns the default TickCaluclator employed by this Range.

Returns:


Copyright © 2010. All Rights Reserved.