

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object org.jaitools.numeric.Range<T>
T
 public class Range<T extends Number & Comparable>
Yet another numeric interval class. It is used with the RangeLookup
operator but
is also available for general use and does not depend on JAI classes.
Range
is a generic class that can be used all Number
types. A range
is defined by its endpoints. If the min (lower bound) endpoint is the same as the
max (upperbound) endpoint then the range represents a point, also referred to as
a degenerate interval.
An endpoint can be positioned at a finite value, in which case it is said to be closed, or at positive or negative infinity, in which case it is said to be open. For finite endpoints, a range can include or exclude the endpoint. Included endpoints correspond to squarebrackets in interval notation, while excluded endpoints correspond to round brackets.
The following rules apply to Float and Double NaN values...
RangeComparator
,
RangeLookupDescriptor
Nested Class Summary  

static class 
Range.Type
Constants to specify whether a Range parameter defines
included or excluded values. 
Field Summary  

static int 
INF
Integer flag value for positive infinity. 
static int 
NEG_INF
Integer flag value for negative infinity. 
Constructor Summary  

Range(Range<T> other)
Creates a copy of another Range instance. 

Range(T minValue,
boolean minIncluded,
T maxValue,
boolean maxIncluded)
Creates a new Range with nonzero width (may be infinite). 

Range(T value,
int... inf)
Creates a new point (degenerate) range. 
Method Summary  

boolean 
contains(T value)
Tests if this range contains the specified, nonnull value. 

static

create(T minValue,
boolean minIncluded,
T maxValue,
boolean maxIncluded)
Static create method. 

static

create(T value,
int... inf)
Creates a Range instance that is a point (degenerate) interval. 

boolean 
equals(Object obj)
Tests for equality with another range. 

T 
getMax()
Gets the maximum value of this range. 

T 
getMin()
Gets the minimum value for this range. 

int 
hashCode()


boolean 
intersects(Range<T> other)
Tests if this range intersects another range. 

boolean 
isMaxClosed()
Tests if this range has a bounded (closed) maximum value. 

boolean 
isMaxIncluded()
Tests if the maximum range value is included in the range. 

boolean 
isMaxInf()
Tests if the maximum value is positive infinity. 

boolean 
isMaxNegInf()
Tests if the maximum value is negative infinity. 

boolean 
isMaxOpen()
Tests if this range has unbounded (open) upper end, ie the range extends to positive infinity. 

boolean 
isMinClosed()
Tests if this range has a bounded (closed) minimum. 

boolean 
isMinIncluded()
Tests if the minimum value is included in the range. 

boolean 
isMinInf()
Tests if the minimum value is positive infinity. 

boolean 
isMinNegInf()
Tests if the minimum value is negative infinity. 

boolean 
isMinOpen()
Tests if this range has an unbounded (open) minimum, ie. 

boolean 
isPoint()
Checks if this range is a point (degenerate) interval 

String 
toString()
Returns a string representation of this range. 
Methods inherited from class java.lang.Object 

clone, finalize, getClass, notify, notifyAll, wait, wait, wait 
Field Detail 

public static final int NEG_INF
public static final int INF
Constructor Detail 

public Range(T minValue, boolean minIncluded, T maxValue, boolean maxIncluded)
minValue
 the lower bound; passing null for this parameter
means an open lower bound; for Float or Double types, the
relevant NEGATIVE_INFINITY value can also be used.minIncluded
 true if the lower bound is to be included in the
range; false to exclude the lower bound; overridden to be false if the
lower bound is openmaxValue
 the upper bound; passing null for this parameter
means an open upper bound; for Float or Double types, the
relevant NEGATIVE_INFINITY value can also be used.maxIncluded
 true if the upper bound is to be included in the
range; false to exclude the upper bound; overridden to be false if the
upper bound is openpublic Range(T value, int... inf)
Where value is finite the following apply:
Range<Integer> rInf = new Range<Integer>(null, Range.INF);
Range<Integer> rNegInf = new Range<Integer>(null, Range.NEG_INF);
// or with the static create method...
Range<Integer> rInf2 = Range.create(null, Range.INF);
For a point interval at positive or negative infinity the following apply:
value
 the value to set for both min and max endpointsinf
 either Range.INF or Range.NEG_INF (ignored if present when value is nonnull)public Range(Range<T> other)
other
 the range to copyMethod Detail 

public static <T extends Number & Comparable> Range<T> create(T minValue, boolean minIncluded, T maxValue, boolean maxIncluded)
Range<Integer> r = new Range<Integer>(10, false, 20, true);
you can do this...
Range<Integer> r = Range.create(10, false, 20, true);
T
 value typeminValue
 the lower bound; passing null for this parameter
means an open lower bound; for Float or Double types, the
relevant NEGATIVE_INFINITY value can also be used.minIncluded
 true if the lower bound is to be included in the
range; false to exclude the lower bound; overridden to be false if the
lower bound is openmaxValue
 the upper bound; passing null for this parameter
means an open upper bound; for Float or Double types, the
relevant NEGATIVE_INFINITY value can also be used.maxIncluded
 true if the upper bound is to be included in the
range; false to exclude the upper bound; overridden to be false if the
upper bound is open
public static <T extends Number & Comparable> Range<T> create(T value, int... inf)
T
 value typevalue
 the value to set for both min and max endpointsinf
 either Range.INF or Range.NEG_INF (ignored if value is nonnull)
public boolean isPoint()
true
if this is a point; false
otherwisepublic T getMin()
Caution: If the range is loweropen (ie. isMinOpen() returns true) this method will return null.
public boolean isMinInf()
true
if positive infinity; false
otherwisepublic boolean isMinNegInf()
true
if negative infinity; false
otherwisepublic T getMax()
Caution: If the range is upperopen (ie. isMaxOpen() returns true) this method will return null.
public boolean isMaxInf()
true
if positive infinity; false
otherwisepublic boolean isMaxNegInf()
true
if negative infinity; false
otherwisepublic boolean isMinIncluded()
true
if minimum value is included; false
otherwiseisMinOpen()
,
isMinClosed()
public boolean isMaxIncluded()
true
if maximum value is included; false
otherwiseisMaxOpen()
,
isMaxClosed()
public boolean isMinOpen()
true
if unbounded; false
otherwiseisMinIncluded()
public boolean isMinClosed()
true
if bounded; false
otherwiseisMinIncluded()
public boolean isMaxOpen()
true
if unbounded; false
otherwiseisMaxIncluded()
public boolean isMaxClosed()
true
if bounded; false
otherwiseisMaxIncluded()
public boolean contains(T value)
value
 the value
true
if the value is within this range; false
otherwisepublic boolean intersects(Range<T> other)
other
 the range to check for intersection
true
if the ranges intersect; false
otherwisepublic boolean equals(Object obj)
equals
in class Object
obj
 the other range
true
if equal; false
otherwisepublic int hashCode()
hashCode
in class Object
public String toString()
Examples of output:
[10, 20]
(Inf, 42)
toString
in class Object


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 