java.lang.Object
org.jfree.chart3d.data.Range
- All Implemented Interfaces:
Serializable
public class Range extends Object implements Serializable
Represents a range of data values (instances are immutable).
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description Range(double min, double max)
Creates a new range instance. -
Method Summary
Modifier and Type Method Description boolean
contains(double value)
Returnstrue
if the range includes the specified value, andfalse
otherwise.boolean
equals(Object obj)
Tests this instance for equality with an arbitrary object.double
getLength()
Returns the length of the range.double
getMax()
Returns the upper bound of the range.double
getMin()
Returns the lower bound of the range.int
hashCode()
Returns a hash code for this instance.boolean
intersects(double bound1, double bound2)
Returnstrue
if the range intersects the interval defined by the two bounds (the order of the bounds is not important), andfalse
otherwise.boolean
intersects(Range range)
Returnstrue
if this range intersects with the specified range, andfalse
otherwise.double
peggedValue(double value)
Returns either (a) the supplied value, if it falls within the range, or (b) the range minimum or maximum value, whichever is closest to value.double
percent(double value)
Returns the value as a percentage along the range.double
percent(double value, boolean inverted)
Returns the value as a percentage along the range, with optionally the result inverted (that is, p becomes 1.0 - p).String
toString()
Returns a string representation of this instance, primarily for debugging purposes.double
value(double percent)
Returns the value corresponding to the specified percentage.
-
Constructor Details
-
Range
Creates a new range instance.- Parameters:
min
- the lower bound of the range.max
- the upper bound of the range.
-
-
Method Details
-
getMin
Returns the lower bound of the range.- Returns:
- The lower bound of the range.
-
getMax
Returns the upper bound of the range.- Returns:
- The upper bound of the range.
-
getLength
Returns the length of the range.- Returns:
- The length of the range.
-
contains
Returnstrue
if the range includes the specified value, andfalse
otherwise.- Parameters:
value
- the value.- Returns:
- A boolean.
-
peggedValue
Returns either (a) the supplied value, if it falls within the range, or (b) the range minimum or maximum value, whichever is closest to value.- Parameters:
value
- the value.- Returns:
- The pegged value.
-
intersects
Returnstrue
if the range intersects the interval defined by the two bounds (the order of the bounds is not important), andfalse
otherwise.- Parameters:
bound1
- the first boundary value.bound2
- the second boundary value.- Returns:
- A boolean.
-
intersects
Returnstrue
if this range intersects with the specified range, andfalse
otherwise.- Parameters:
range
- the range (null
not permitted).- Returns:
- A boolean.
- Since:
- 1.2
-
percent
Returns the value as a percentage along the range.- Parameters:
value
- the value.- Returns:
- The percentage.
-
percent
Returns the value as a percentage along the range, with optionally the result inverted (that is, p becomes 1.0 - p).- Parameters:
value
- the value.inverted
- invert the result?- Returns:
- The percentage.
- Since:
- 1.5
-
value
Returns the value corresponding to the specified percentage.- Parameters:
percent
- the percentage along the range.- Returns:
- The value.
- Since:
- 1.1
-
equals
Tests this instance for equality with an arbitrary object. -
hashCode
Returns a hash code for this instance. -
toString
Returns a string representation of this instance, primarily for debugging purposes.
-