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

Variable Index

 o maxval
maximum of range
 o minval
minimum of range

Constructor Index

 o RealRange()
creates invalid range from POSITIVE_INFINITY to NEGATIVE_INFINITY
 o RealRange(double, double)
initialise with min and max values; if minv > maxv create inValid RealRange
 o RealRange(RealRange)
copy constructor

Method Index

 o add(double)
add a value to a range
 o contains(double)
synonym for includes()
 o equals(RealRange)
invalid ranges return false
 o getMax()
get maximum value (NEGATIVE_INFINITY if inValid)
 o getMin()
get minimum value (POSITIVE_INFINITY if inValid)
 o getRange()
get range (NaN if invalid)
 o includes(double)
is a double within a RealRange? If inValid, return false
 o includes(RealRange)
does one range include another?
 o intersectionWith(RealRange)
intersect two ranges and take the range common to both; return invalid range if no overlap
 o isValid()
a Range is only valid if its maxval is not less than its minval; this tests for uninitialised ranges
 o main(String[])
tests RealRange routines
 o plus(RealRange)
combine two ranges if both valid; takes greatest limits of both, else returns InValid
 o toString()
output

Variables

 o maxval
  protected double maxval
maximum of range
 o minval
  protected double minval
minimum of range

Constructors

 o RealRange
  public RealRange()
creates invalid range from POSITIVE_INFINITY to NEGATIVE_INFINITY
 o RealRange
  public RealRange(double minv,
                   double maxv)
initialise with min and max values; if minv > maxv create inValid RealRange
 o RealRange
  public RealRange(RealRange r)
copy constructor

Methods

 o isValid
  public boolean isValid()
a Range is only valid if its maxval is not less than its minval; this tests for uninitialised ranges
 o equals
  public boolean equals(RealRange r)
invalid ranges return false
 o plus
  public RealRange plus(RealRange r2)
combine two ranges if both valid; takes greatest limits of both, else returns InValid
 o intersectionWith
  public RealRange intersectionWith(RealRange r2)
intersect two ranges and take the range common to both; return invalid range if no overlap
 o getMin
  public double getMin()
get minimum value (POSITIVE_INFINITY if inValid)
 o getMax
  public double getMax()
get maximum value (NEGATIVE_INFINITY if inValid)
 o getRange
  public double getRange()
get range (NaN if invalid)
 o includes
  public boolean includes(RealRange r2)
does one range include another?
 o includes
  public boolean includes(double f)
is a double within a RealRange? If inValid, return false
 o contains
  public boolean contains(double f)
synonym for includes()
 o add
  public void add(double x)
add a value to a range
 o toString
  public String toString()
output
Overrides:
toString in class Object
 o main
  public static void main(String args[])
tests RealRange routines

All Packages  Class Hierarchy  This Package  Previous  Next  Index