T
- The type of range which should extend Comparable
of Tpublic interface IRange<T extends java.lang.Comparable<T>>
extends java.lang.Cloneable
Modifier and Type | Method and Description |
---|---|
void |
addRangeChangeObserver(IRangeChangeObserver<T> observer)
Adds
IRangeChangeObserver instance to listen changes of this IRange instance |
void |
clipTo(IRange<T> maximumRange)
Clips the current
IRange to a maximum range with MinMax mode |
void |
clipTo(IRange<T> maximumRange,
RangeClipMode clipMode)
Clips the current
IRange to a maximum according to clip mode |
IRange<T> |
clone()
Creates and returns a copy of this object
|
T |
getDiff()
Gets the difference (max - min) of this range
|
boolean |
getIsDefined()
Gets whether this Range is defined
|
boolean |
getIsMinMaxValid()
Gets whether the min and max value are valid ( min <= max )
|
boolean |
getIsZero()
Gets whether the range is Zero, where max equals min
|
IMath<T> |
getMath()
Gets the
IMath associated with this range |
T |
getMax()
Gets the max value of this range
|
double |
getMaxAsDouble()
Gets the double representation of max value
|
T |
getMin()
Gets the min value of this range
|
double |
getMinAsDouble()
Gets the double representation of min value
|
java.lang.Class<T> |
getValueType()
Gets the type of range values
|
void |
growBy(double minFraction,
double maxFraction)
Grows the current
IRange by the min and max fraction |
boolean |
isValueWithinRange(T value)
Returns true if the value is within the min and max of the Range
|
void |
removeRangeChangeObserver(IRangeChangeObserver<T> observer)
Removes
IRangeChangeObserver instance from list of change listeners for this IRange instance |
void |
set(IRange<T> range)
Sets the min, max values on the
IRange with a range |
void |
setMax(T max)
Sets the max value of this range
|
void |
setMin(T min)
Sets the min value of this range
|
void |
setMinMax(T min,
T max)
Sets the min, max values on the
IRange |
void |
setMinMaxDouble(double min,
double max)
Sets the min, max values on the
IRange |
void |
setMinMaxDoubleForced(double min,
double max)
Sets the min, max values on the
IRange without equals checks |
void |
setMinMaxForced(T min,
T max)
Sets the min, max values on the
IRange without equals checks |
void |
setMinMaxWithLimit(double min,
double max,
IRange<T> maximumRange)
Sets the min, max values on the
IRange with a max range
to clip values to |
void |
union(IRange<T> range)
Performs the union of two
IRange instances |
void |
union(T min,
T max)
Performs the union of two
IRange instances |
T getMax()
void setMax(T max)
max
- value to be setT getMin()
void setMin(T min)
min
- value to be setT getDiff()
boolean getIsDefined()
boolean getIsZero()
boolean getIsMinMaxValid()
double getMaxAsDouble()
double getMinAsDouble()
java.lang.Class<T> getValueType()
void growBy(double minFraction, double maxFraction)
IRange
by the min and max fractionminFraction
- The min fraction to grow by. For example, min = -10 and minFraction = 0.1
will result in the new min = -11maxFraction
- The max fraction to grow by. For example, max = 10 and minFraction = 0.2
will result in the new max = 12void setMinMaxDouble(double min, double max)
IRange
min
- New min valuemax
- New max valuevoid setMinMaxDoubleForced(double min, double max)
IRange
without equals checksmin
- New min valuemax
- New max valuevoid setMinMaxWithLimit(double min, double max, IRange<T> maximumRange)
IRange
with a max range
to clip values tomin
- New min valuemax
- New max valuemaximumRange
- The max range, which is used to clip valuesvoid setMinMax(T min, T max)
IRange
min
- New min valuemax
- New max valuevoid setMinMaxForced(T min, T max)
IRange
without equals checksmin
- New min valuemax
- New max valuevoid set(IRange<T> range)
IRange
with a rangerange
- input rangevoid union(IRange<T> range)
IRange
instancesrange
- input rangevoid union(T min, T max)
IRange
instancesmin
- The min valuemax
- The max valuevoid clipTo(IRange<T> maximumRange)
IRange
to a maximum range with MinMax modemaximumRange
- range to comparevoid clipTo(IRange<T> maximumRange, RangeClipMode clipMode)
IRange
to a maximum according to clip modemaximumRange
- range to compareclipMode
- clip mode which defines how to clip rangeboolean isValueWithinRange(T value)
value
- the value to testIRange<T> clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
- if the object's class does not
support the Cloneable
interface. Subclasses
that override the clone
method can also
throw this exception to indicate that an instance cannot
be cloned.void addRangeChangeObserver(IRangeChangeObserver<T> observer)
IRangeChangeObserver
instance to listen changes of this IRange
instanceobserver
- The observer to addvoid removeRangeChangeObserver(IRangeChangeObserver<T> observer)
IRangeChangeObserver
instance from list of change listeners for this IRange
instanceobserver
- The observer to remove