|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectRange
Range<T>
T - The type of range elements, typically Date or some subclass
of Number.Range.
@Immutable @Deprecated public class Range<T extends Comparable<? super T>>
A range between a minimum and maximum comparable. The minimum/maximum may be included, excluded
or unbounded. The later case is indicated by null values on one or both ends.
This class is a method compatible replacement for the Java Advanced Imaging
Range class with the following differences:
Unbounded ranges (i.e. null minimal or maximal values) are considered
exclusive rather than inclusive, since an iteration over the values will
never reach the infinite bound. This interpretation brings some simplification in
implementation and usage (e.g. a loop over the values should not attempt to process
the null value).
subtract(Range) returns an empty array if the whole range is subtracted.
NumberRange do that). This
class is weakly parameterized in order to allow this flexibility. If any constructor or method
is invoked with an argument value of illegal class, then an IllegalArgumentException is
thrown. The ClassCastException is thrown only in case of bug in the Range class
or subclasses implementation.
The string representation of a Range is
defined in a locale-insensitive way. In order to format a range using the
current locale, or for parsing a range, use
RangeFormat.
Range,
RangeFormat,
Serialized Form
| utility/geotk-utility (download) | View source code for this class |
| Constructor Summary | |
|---|---|
Range(Class<T> elementClass,
T value)
Deprecated. Creates a new range bounded by a single inclusive value. |
|
Range(Class<T> elementClass,
T minValue,
boolean isMinIncluded,
T maxValue,
boolean isMaxIncluded)
Deprecated. Creates a new range bounded by the given values. |
|
Range(Class<T> elementClass,
T minValue,
T maxValue)
Deprecated. Creates a new range bounded by the given inclusive values. |
|
| Method Summary | |
|---|---|
boolean |
contains(Comparable value)
Deprecated. Returns true if this range contains the given value. |
boolean |
contains(Range<?> range)
Deprecated. Returns true if the supplied range is fully contained within this range. |
boolean |
equals(Object object)
Deprecated. Compares this range with the given object for equality. |
Class<T> |
getElementType()
Deprecated. Returns the class of elements in this range. |
T |
getMaxValue()
Deprecated. Returns the maximal value, or null if unbounded. |
T |
getMinValue()
Deprecated. Returns the minimal value, or null if unbounded. |
int |
hashCode()
Deprecated. Returns a hash code value for this range. |
Range<?> |
intersect(Range<?> range)
Deprecated. Returns the intersection between this range and the provided range. |
boolean |
intersects(Range<?> range)
Deprecated. Returns true if this range intersects the given range. |
boolean |
isMaxIncluded()
Deprecated. Indicates if getMaxValue() is included in the range. |
boolean |
isMinIncluded()
Deprecated. Indicates if getMinValue() is included in the range. |
Range<?>[] |
subtract(Range<?> range)
Deprecated. Returns the range of values that are in this range but not in the given range. |
String |
toString()
Deprecated. Returns a string representation of this range. |
Range<?> |
union(Range<?> range)
Deprecated. Returns the union of this range with the given range. |
| Methods inherited from class Range |
|---|
contains, formatTo, intersect, intersects, isEmpty, subtract, union |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Range(Class<T> elementClass,
T value)
elementClass - The class of the range elements.value - The minimal and maximum value (inclusive), or null for an unbounded range.
public Range(Class<T> elementClass,
T minValue,
T maxValue)
elementClass - The class of the range elements.minValue - The minimal value (inclusive), or null if none.maxValue - The maximal value (inclusive), or null if none.
public Range(Class<T> elementClass,
T minValue,
boolean isMinIncluded,
T maxValue,
boolean isMaxIncluded)
elementClass - The class of the range elements.minValue - The minimal value, or null if none.isMinIncluded - true if the minimal value is inclusive, or false if exclusive.maxValue - The maximal value, or null if none.isMaxIncluded - true if the maximal value is inclusive, or false if exclusive.| Method Detail |
|---|
public Class<T> getElementType()
Comparable.
getElementType in interface CheckedContainergetElementType in class RangeRange.getElementClass()public T getMinValue()
null if unbounded. If isMinIncluded
is true, then the value is considered included in the set. Otherwise it is
considered excluded.
getMinValue in class RangeRange.getMinValue()public boolean isMinIncluded()
getMinValue() is included in the range.
isMinIncluded in class Rangetrue if the minimal value is inclusive.Range.isMinIncludedpublic T getMaxValue()
null if unbounded. If isMaxIncluded
is true, then the value is considered included in the set. Otherwise it is
considered excluded.
getMaxValue in class RangeRange.getMaxValue()public boolean isMaxIncluded()
getMaxValue() is included in the range.
isMaxIncluded in class Rangetrue if the maximal value is inclusive.Range.isMaxIncluded
public boolean contains(Comparable value)
throws IllegalArgumentException
true if this range contains the given value. A range never contains the
null value. This is consistent with the class javadoc
stating that null minimum or maximum
values are exclusive.
contains in class Rangevalue - The value to check for inclusion in this range.
true if the given value is included in this range.
IllegalArgumentException - is the given value can not be converted to a valid type
through widening conversion.
public boolean contains(Range<?> range)
throws IllegalArgumentException
true if the supplied range is fully contained within this range.
range - The range to check for inclusion in this range.
true if the given range is included in this range.
IllegalArgumentException - is the given range can not be converted to a valid type
through widening conversion, or if the units of measurement are not convertible.
public boolean intersects(Range<?> range)
throws IllegalArgumentException
true if this range intersects the given range.
range - The range to check for intersection with this range.
true if the given range intersects this range.
IllegalArgumentException - is the given range can not be converted to a valid type
through widening conversion, or if the units of measurement are not convertible.Range.intersects(javax.media.jai.util.Range)
public Range<?> intersect(Range<?> range)
throws IllegalArgumentException
range - The range to intersect.
IllegalArgumentException - is the given range can not be converted to a valid type
through widening conversion, or if the units of measurement are not convertible.Range.intersect(javax.media.jai.util.Range)
public Range<?>[] subtract(Range<?> range)
throws IllegalArgumentException
range - The range to subtract.
IllegalArgumentException - is the given range can not be converted to a valid type
through widening conversion, or if the units of measurement are not convertible.Range.subtract(javax.media.jai.util.Range)
public Range<?> union(Range<?> range)
throws IllegalArgumentException
range - The range to add to this range.
IllegalArgumentException - is the given range can not be converted to a valid type
through widening conversion, or if the units of measurement are not convertible.Range.union(javax.media.jai.util.Range)public boolean equals(Object object)
equals in class Rangeobject - The object to compare with this range for equality.
true if the given object is equal to this range.public int hashCode()
hashCode in class Rangepublic String toString()
"[]".[min … max] for inclusive bounds or
(min … max) for exclusive bounds, or a mix of both styles.
The ∞ symbol is used in place of min or max for
unbounded ranges.
If this range is a MeasurementRange, then the unit of measurement is
appended to the above string representation.
toString in class RangeRangeFormat
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||