Class pmr.euclid.RealRange
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.euclid.RealRange
java.lang.Object
|
+----pmr.euclid.Status
|
+----pmr.euclid.RealRange
- public class RealRange
- extends Status
RealRange - maximum and minimum values
Contains two doubles 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 RealRange
it becomes initialised.
- Author:
- (C) P. Murray-Rust, 1996
-
maxval
- maximum of range
-
minval
- minimum of range
-
RealRange()
- creates invalid range from POSITIVE_INFINITY to NEGATIVE_INFINITY
-
RealRange(double, double)
- initialise with min and max values;
if minv > maxv create inValid RealRange
-
RealRange(RealRange)
- copy constructor
-
add(double)
- add a value to a range
-
contains(double)
- synonym for includes()
-
equals(RealRange)
- invalid ranges return false
-
getMax()
- get maximum value (NEGATIVE_INFINITY if inValid)
-
getMin()
- get minimum value (POSITIVE_INFINITY if inValid)
-
getRange()
- get range (NaN if invalid)
-
includes(double)
- is a double within a RealRange? If inValid, return false
-
includes(RealRange)
- does one range include another?
-
intersectionWith(RealRange)
- 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 RealRange routines
-
plus(RealRange)
- combine two ranges if both valid; takes greatest limits of both,
else returns InValid
-
toString()
- output
maxval
protected double maxval
- maximum of range
minval
protected double minval
- minimum of range
RealRange
public RealRange()
- creates invalid range from POSITIVE_INFINITY to NEGATIVE_INFINITY
RealRange
public RealRange(double minv,
double maxv)
- initialise with min and max values;
if minv > maxv create inValid RealRange
RealRange
public RealRange(RealRange 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(RealRange r)
- invalid ranges return false
plus
public RealRange plus(RealRange r2)
- combine two ranges if both valid; takes greatest limits of both,
else returns InValid
intersectionWith
public RealRange intersectionWith(RealRange r2)
- intersect two ranges and take the range common to both; return invalid
range if no overlap
getMin
public double getMin()
- get minimum value (POSITIVE_INFINITY if inValid)
getMax
public double getMax()
- get maximum value (NEGATIVE_INFINITY if inValid)
getRange
public double getRange()
- get range (NaN if invalid)
includes
public boolean includes(RealRange r2)
- does one range include another?
includes
public boolean includes(double f)
- is a double within a RealRange? If inValid, return false
contains
public boolean contains(double f)
- synonym for includes()
add
public void add(double 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 RealRange routines
All Packages Class Hierarchy This Package Previous Next Index