|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
A Scale is an object that represents a scale from a
mathematical point of view. It consists of two values: the minimum
scale value and the maximum scale value, which together define an
interval or numerical range. A Scale can be implemented
as a linear or logarithmic Scale.
Linear Scale (min: 0, max: 10)
Linear Scale (min: -500, max: 2000)
To avoid creating identical Scale objects (same type
and interval), instances are pooled in the ScalePool
singleton. Since many clients may have a reference to the very
same instance, Scale objects are immutable. A mutable
version is defined by the MutableScale interface.
To work with these values the
Scale provides the methods listed below:
In order to convert a value from one Scale into another, this
interface provides the following methods:
scale(double, double, double)descale(double, double, double)getScaleFactor(double, double)getDescaleFactor(double, double)
Scale that are not in the ScalePool and not reference
by any other object will be garbage collected.
| Field Summary | |
static java.lang.String |
TYPE_LINEAR
String constant defining linear Scales |
| Method Summary | |
Scale |
deepCopy()
Method to deep copy this scale instance. |
double |
descale(double minimum,
double maximum,
double valueToDescale)
Converts the value given by valueToDescale from the range
given by minimum and maximum to the range of
this Scale. |
double |
getDescaleFactor(double minimum,
double maximum)
Returns the scale factor that converts a value from the range given by minimum and maximum to range of this
Scale. |
double |
getScaleFactor(double minimum,
double maximum)
Returns the scale factor that converts a value from the range of this Scale to the range given by minimum and
maximum. |
double |
getScaleMaximum()
Returns the maximum scale value for this Scale. |
double |
getScaleMinimum()
Returns the minimum scale value for this Scale. |
double |
getScaleRange()
Returns the scale range for this Scale. |
double |
scale(double minimum,
double maximum,
double valueToScale)
Converts the value given by valueToScale from the range of
this Scale to the range given by minimum and
maximum. |
| Field Detail |
public static final java.lang.String TYPE_LINEAR
String constant defining linear Scales
| Method Detail |
public double getScaleMinimum()
Scale.
public double getScaleMaximum()
Scale.
public double getScaleRange()
Scale. The scale range is
defined as the interval between the minimum scale value and the maximum
scale value. The mathematical expression for this is:
public double getScaleFactor(double minimum,
double maximum)
Scale to the range given by minimum and
maximum. The mathematical expression for this is:maximum - minimum) /
(maximum scale value - minimum scale value)
.
minimum - the minimum value of the range to convert tomaximum - the maximum value of the range to convert to
public double getDescaleFactor(double minimum,
double maximum)
minimum and maximum to range of this
Scale. The mathematical expression for this is:maximum - minimum)
.
minimum - the minimum value of the range to convert frommaximum - the maximum value of the range to convert from
public double scale(double minimum,
double maximum,
double valueToScale)
valueToScale from the range of
this Scale to the range given by minimum and
maximum. The mathematical expression for this is:valueToScale *
(maximum - minimum) /
(maximum scale value - minimum scale value)
.
minimum - the minimum value of the range to convert tomaximum - the maximum value of the range to convert tovalueToScale - the value to convert
public double descale(double minimum,
double maximum,
double valueToDescale)
valueToDescale from the range
given by minimum and maximum to the range of
this Scale. The mathematical expression for this is:valueToScale *
(maximum scale value - minimum scale value) /
(maximum - minimum)
.
minimum - the minimum value of the range to convert frommaximum - the maximum value of the range to convert fromvalueToDescale - the value to convert
public Scale deepCopy()
Scale.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||