T - public class Interval<T extends Number> extends Object implements Cloneable, Comparable<Interval<T>>
| Modifier and Type | Class and Description |
|---|---|
static class |
Interval.Rule
Bound rules values.
|
| Constructor and Description |
|---|
Interval(T minimum,
T maximum)
Creates a new instance.
|
Interval(T minimum,
T maximum,
Interval.Rule minimumRule,
Interval.Rule maximumRule)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
Interval<T> |
clone()
Creates a copy of this interval.
|
int |
compareTo(Interval<T> o) |
boolean |
contains(Interval<?> interval)
Indicates whether the provided interval belongs to this interval.
|
boolean |
contains(Number number)
Indicates whether the provided value belongs to this interval.
|
boolean |
equals(Interval<?> interval) |
boolean |
equals(Object obj) |
T |
getMaximum()
Gets the maximum value.
|
Interval.Rule |
getMaximumRule()
Gets the rule of the maximum bound.
|
T |
getMinimum()
Gets the minimum value.
|
Interval.Rule |
getMinimumRule()
Gets the rule of the minimum bound.
|
int |
hashCode() |
boolean |
intersects(Interval<?> interval)
Indicates whether the provided interval intersects to this interval.
|
double |
maximum()
Gets the maximum value in
double precision. |
double |
minimum()
Gets the minimum value in
double precision. |
static double |
project(double value,
double inMin,
double inMax,
double outMin,
double outMax)
Project interval
[inMin, inMax] on interval
[outMin, outMax] and return the image of the given value. |
static double |
project(Number number,
Interval<? extends Number> source,
Interval<? extends Number> destination)
Project interval
[source] on interval
[destination] ands return the image of the given value. |
double |
range()
Gets the
maximum - minimum value in double
precision. |
static double |
rescale(double value,
double minimum,
double maximum)
Rescale the provided number to fit into the
[minimum, maximum]
interval. |
double |
rescale(Number number)
Rescale the provided number to fit into this interval.
|
static double |
rescale(Number number,
Interval<? extends Number> interval)
Rescale the provided number to fit into the provided interval.
|
String |
toString() |
public Interval(T minimum, T maximum) throws IllegalArgumentException
minimum - The minimum value.maximum - The maximum value.IllegalArgumentException - If either minimum or
maximum is null.public Interval(T minimum, T maximum, Interval.Rule minimumRule, Interval.Rule maximumRule) throws IllegalArgumentException
minimum - The minimum value.maximum - The maximum value.minimumRule - The rule for the minimum bound; can be null
. null will be set to Rule.INCLUSIVE.maximumRule - The rule for the maximum bound; can be null
. null will be set to Rule.INCLUSIVE.IllegalArgumentException - If either minimum or
maximum is null or if the specified
interval is invalid. public boolean equals(Interval<?> interval)
interval - The interval to be tested.True if the test is verified; false
otherwise.public T getMinimum()
T instance.public T getMaximum()
T instance.public double minimum()
double precision.double.public double maximum()
double precision.double.public double range()
maximum - minimum value in double
precision.double.public Interval.Rule getMinimumRule()
Rule instance; never null.public Interval.Rule getMaximumRule()
Rule instance; never null.public boolean contains(Number number) throws IllegalArgumentException
number - The value to be tested.True if the test is verified; false
otherwise.IllegalArgumentException - If number is
null or this interval is invalid.public boolean contains(Interval<?> interval) throws IllegalArgumentException
interval - The interval to be tested.True if the test is verified; false
otherwise.IllegalArgumentException - If interval is
null.public boolean intersects(Interval<?> interval) throws IllegalArgumentException
interval - The interval to be tested.True if the test is verified; false
otherwise.IllegalArgumentException - If interval is
null.public double rescale(Number number) throws IllegalArgumentException
number - The number to rescale.double.IllegalArgumentException - If number is
null.public static double rescale(Number number, Interval<? extends Number> interval) throws IllegalArgumentException
number - The number to rescale.interval - The source interval.double.IllegalArgumentException - If number or
intervall. is null.public static double rescale(double value,
double minimum,
double maximum)
[minimum, maximum]
interval.value - The value to rescale.minimum - The minimum value.maximum - The maximum value.double.public static double project(Number number, Interval<? extends Number> source, Interval<? extends Number> destination) throws IllegalArgumentException
[source] on interval
[destination] ands return the image of the given value.number - The value to be projected.source - The source interval (value must be contained within the
interval).destination - The destination interval.IllegalArgumentException - If value, source
or destination is null or if
source has a range of 0.public static double project(double value,
double inMin,
double inMax,
double outMin,
double outMax)
throws IllegalArgumentException
[inMin, inMax] on interval
[outMin, outMax] and return the image of the given value. Interval objects.value - The value to be projected.inMin - The source minimum.inMax - The source maximum.outMin - The destination minimum.outMax - the destination maximum.IllegalArgumentException - If the source interval has a range of 0.Copyright © 2016 Laboratoire COGIT, IGN. All rights reserved.