com.jidesoft.range
Class CombinedNumericRange

java.lang.Object
  extended by com.jidesoft.range.AbstractRange<T>
      extended by com.jidesoft.range.AbstractNumericRange<java.lang.Double>
          extended by com.jidesoft.range.CombinedNumericRange
All Implemented Interfaces:
Range<java.lang.Double>

public class CombinedNumericRange
extends AbstractNumericRange<java.lang.Double>

A little convenience class to compute the maximum and minimum values of multiple ranges.

Author:
swhite@catalysoft.com

Field Summary
 
Fields inherited from interface com.jidesoft.range.Range
PROPERTY_MAX, PROPERTY_MIN
 
Constructor Summary
CombinedNumericRange()
          Using this constructor relies on the user subsequently calling add() to add a range
 
Method Summary
 CombinedNumericRange add(Range<java.lang.Double> range)
          Add a new range to this combined range.
 void adjust(java.lang.Double lower, java.lang.Double upper)
          Adjusts the range.
 boolean contains(java.lang.Double x)
          This range contains some point iff one or more of its subranges contain that point
 java.lang.Double lower()
          The lower value in the range; here, the same as minimum
 double maximum()
          Lazily calculates the maximum value in the range
 double minimum()
          Lazily calculates the minimum value in the range
 double size()
          Compute the size of the range
 java.lang.Double upper()
          The upper value in the range; here, the same as maximum()
 
Methods inherited from class com.jidesoft.range.AbstractRange
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinedNumericRange

public CombinedNumericRange()
Using this constructor relies on the user subsequently calling add() to add a range

Method Detail

add

public CombinedNumericRange add(Range<java.lang.Double> range)
Add a new range to this combined range. Notice this method returns this instance, so method calls can be chained together.

Parameters:
range - the new range to add
Returns:
this instance

lower

public java.lang.Double lower()
The lower value in the range; here, the same as minimum

Returns:
the smallest value of the range

upper

public java.lang.Double upper()
The upper value in the range; here, the same as maximum()

Returns:
the largest value of the range

adjust

public void adjust(java.lang.Double lower,
                   java.lang.Double upper)
Description copied from interface: Range
Adjusts the range.

Parameters:
lower - the new smallest value of the range
upper - the new largest value of the range

maximum

public double maximum()
Lazily calculates the maximum value in the range

Returns:
The numeric value of the largest value to include in the range.

minimum

public double minimum()
Lazily calculates the minimum value in the range

Returns:
the numeric value of the smallest value to include in the range.

contains

public boolean contains(java.lang.Double x)
This range contains some point iff one or more of its subranges contain that point

Returns:
a boolean to indicate whether the supplied point lies within the range

size

public double size()
Description copied from interface: Range
Compute the size of the range



Copyright © 2009. All Rights Reserved.