Class Range

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.
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)
    Returns true if the range includes the specified value, and false 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)
    Returns true if the range intersects the interval defined by the two bounds (the order of the bounds is not important), and false otherwise.
    boolean intersects​(Range range)
    Returns true if this range intersects with the specified range, and false 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.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Range

      public Range​(double min, double max)
      Creates a new range instance.
      Parameters:
      min - the lower bound of the range.
      max - the upper bound of the range.
  • Method Details

    • getMin

      public double getMin()
      Returns the lower bound of the range.
      Returns:
      The lower bound of the range.
    • getMax

      public double getMax()
      Returns the upper bound of the range.
      Returns:
      The upper bound of the range.
    • getLength

      public double getLength()
      Returns the length of the range.
      Returns:
      The length of the range.
    • contains

      public boolean contains​(double value)
      Returns true if the range includes the specified value, and false otherwise.
      Parameters:
      value - the value.
      Returns:
      A boolean.
    • peggedValue

      public 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.
      Parameters:
      value - the value.
      Returns:
      The pegged value.
    • intersects

      public boolean intersects​(double bound1, double bound2)
      Returns true if the range intersects the interval defined by the two bounds (the order of the bounds is not important), and false otherwise.
      Parameters:
      bound1 - the first boundary value.
      bound2 - the second boundary value.
      Returns:
      A boolean.
    • intersects

      public boolean intersects​(Range range)
      Returns true if this range intersects with the specified range, and false otherwise.
      Parameters:
      range - the range (null not permitted).
      Returns:
      A boolean.
      Since:
      1.2
    • percent

      public double percent​(double value)
      Returns the value as a percentage along the range.
      Parameters:
      value - the value.
      Returns:
      The percentage.
    • percent

      public 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).
      Parameters:
      value - the value.
      inverted - invert the result?
      Returns:
      The percentage.
      Since:
      1.5
    • value

      public double value​(double percent)
      Returns the value corresponding to the specified percentage.
      Parameters:
      percent - the percentage along the range.
      Returns:
      The value.
      Since:
      1.1
    • equals

      public boolean equals​(Object obj)
      Tests this instance for equality with an arbitrary object.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object (null permitted).
      Returns:
      A boolean.
    • hashCode

      public int hashCode()
      Returns a hash code for this instance.
      Overrides:
      hashCode in class Object
      Returns:
      A hash code.
    • toString

      public String toString()
      Returns a string representation of this instance, primarily for debugging purposes.
      Overrides:
      toString in class Object
      Returns:
      A string.