Class pmr.euclid.IntRange
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.euclid.IntRange
java.lang.Object
|
+----pmr.euclid.Status
|
+----pmr.euclid.IntRange
- public class IntRange
- extends Status
IntRange - maximum and minimum values
Contains two ints representing the minimum and maximum of an
allowed or observed range.
Default is range with low > high; this can be regarded as the
uninitialised state. If points are added to a default IntRange
it becomes initialised.
- Author:
- (C) P. Murray-Rust, 1996
-
maxval
- maximum of range
-
minval
- minimum of range
-
IntRange()
- creates invalid range from MAX_VALUE to MIN_VALUE
-
IntRange(int, int)
- initialise with min and max values;
if minv > maxv create inValid IntRange
-
IntRange(IntRange)
- copy constructor
-
add(int)
- add a value to a range
-
contains(int)
- synonym for includes()
-
equals(IntRange)
- invalid ranges return false
-
getMax()
- get maximum value (MIN_VALUE if inValid)
-
getMin()
- get minimum value (MAX_VALUE if inValid)
-
getRange()
- get range (MIN_VALUE if invalid)
-
includes(int)
- is a int within a IntRange? If inValid, return false
-
includes(IntRange)
- does one range include another?
-
intersectionWith(IntRange)
- intersect two ranges and take the range common to both; return invalid
range if no overlap
-
isValid()
- a Range is only valid if its maxval is not less than its minval;
this tests for uninitialised ranges
-
main(String[])
- tests IntRange routines
-
plus(IntRange)
- combine two ranges if both valid; takes greatest limits of both,
else returns InValid
-
toString()
- output
maxval
protected int maxval
- maximum of range
minval
protected int minval
- minimum of range
IntRange
public IntRange()
- creates invalid range from MAX_VALUE to MIN_VALUE
IntRange
public IntRange(int minv,
int maxv)
- initialise with min and max values;
if minv > maxv create inValid IntRange
IntRange
public IntRange(IntRange r)
- copy constructor
isValid
public boolean isValid()
- a Range is only valid if its maxval is not less than its minval;
this tests for uninitialised ranges
equals
public boolean equals(IntRange r)
- invalid ranges return false
plus
public IntRange plus(IntRange r2)
- combine two ranges if both valid; takes greatest limits of both,
else returns InValid
intersectionWith
public IntRange intersectionWith(IntRange r2)
- intersect two ranges and take the range common to both; return invalid
range if no overlap
getMin
public int getMin()
- get minimum value (MAX_VALUE if inValid)
getMax
public int getMax()
- get maximum value (MIN_VALUE if inValid)
getRange
public int getRange()
- get range (MIN_VALUE if invalid)
includes
public boolean includes(IntRange r2)
- does one range include another?
includes
public boolean includes(int f)
- is a int within a IntRange? If inValid, return false
contains
public boolean contains(int f)
- synonym for includes()
add
public void add(int x)
- add a value to a range
toString
public String toString()
- output
- Overrides:
- toString in class Object
main
public static void main(String args[])
- tests IntRange routines
All Packages Class Hierarchy This Package Previous Next Index