com.orsoncharts

## Class Range

- java.lang.Object
- - com.orsoncharts.Range

- All Implemented Interfaces:
    java.io.Serializable

      public class Range
      extends java.lang.Object
      implements java.io.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 and Description
    `Range(double min, double max)` Creates a new range instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(double value)` Returns `true` if the range includes the specified value, and `false` otherwise.
    `boolean` | `equals(java.lang.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).
    `java.lang.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 Detail

    - #### 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 Detail

    - #### 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(java.lang.Object obj)

      Tests this instance for equality with an arbitrary object.
      Overrides:
        `equals` in class `java.lang.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 `java.lang.Object`
      Returns:
        A hash code.

    - #### toString

          public java.lang.String toString()

      Returns a string representation of this instance, primarily for debugging purposes.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A string.