org.jfree.data
Class Range

java.lang.Object
  extended byorg.jfree.data.Range
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DateRange

public class Range
extends java.lang.Object
implements java.io.Serializable

Represents the visible range for an axis.

Instances of this class are immutable.

Author:
David Gilbert
See Also:
Serialized Form

Constructor Summary
Range(double lower, double upper)
          Created a new range.
 
Method Summary
static Range combine(Range range1, Range range2)
          Creates a new range by combining two existing ranges.
 boolean contains(double value)
          Returns true if the range contains the specified value.
 boolean equals(java.lang.Object object)
          Tests this object for equality with another object.
 double getCentralValue()
          Returns the central value for the range.
 double getLength()
          Returns the length of the range.
 double getLowerBound()
          Returns the lower bound for the range.
 double getUpperBound()
          Returns the upper bound for the range.
 java.lang.String toString()
          Returns a string representation of this Range.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Range

public Range(double lower,
             double upper)
Created a new range.

Parameters:
lower - the lower bound.
upper - the upper bound.
Method Detail

getLowerBound

public double getLowerBound()
Returns the lower bound for the range.

Returns:
the lower bound.

getUpperBound

public double getUpperBound()
Returns the upper bound for the range.

Returns:
the upper bound.

getLength

public double getLength()
Returns the length of the range.

Returns:
the length.

getCentralValue

public double getCentralValue()
Returns the central value for the range.

Returns:
the central value.

contains

public boolean contains(double value)
Returns true if the range contains the specified value.

Parameters:
value - the value to lookup.
Returns:
true if the range contains the specified value.

combine

public static Range combine(Range range1,
                            Range range2)
Creates a new range by combining two existing ranges.

Note that:

Parameters:
range1 - the first range.
range2 - the second range.
Returns:
a new range.

equals

public boolean equals(java.lang.Object object)
Tests this object for equality with another object.

Parameters:
object - the object to test against.
Returns:
true or false.

toString

public java.lang.String toString()
Returns a string representation of this Range.

Returns:
a String "Range[lower,upper]" where lower=lower range and upper=upper range.