org.apache.commons.math3.geometry.euclidean.oned

## Class Interval

- java.lang.Object
- - org.apache.commons.math3.geometry.euclidean.oned.Interval

    public class Interval
    extends Object

This class represents a 1D interval.

Since:
  3.0
Version:
  $Id: Interval.java 1422195 2012-12-15 06:45:18Z psteitz $
See Also:
  `IntervalsSet`

### Field Summary

Fields
`private double` `lower` The lower bound of the interval.
`private double` `upper` The upper bound of the interval.

### Constructor Summary

Constructors
Constructor and Description
`Interval(double lower, double upper)` Simple constructor.

### Method Summary

Methods
`Region.Location` `checkPoint(double point, double tolerance)` Check a point with respect to the interval.
`double` `getBarycenter()` Get the barycenter of the interval.
`double` `getInf()` Get the lower bound of the interval.
`double` `getLength()` Deprecated. as of 3.1, replaced by `getSize()`
`double` `getLower()` Deprecated. as of 3.1, replaced by `getInf()`
`double` `getMidPoint()` Deprecated. as of 3.1, replaced by `getBarycenter()`
`double` `getSize()` Get the size of the interval.
`double` `getSup()` Get the upper bound of the interval.
`double` `getUpper()` Deprecated. as of 3.1, replaced by `getSup()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### lower

    private final double lower

The lower bound of the interval.

#### upper

    private final double upper

The upper bound of the interval.

### Constructor Detail

#### Interval

    public Interval(double lower,
            double upper)

Simple constructor.

Parameters:
  `lower` - lower bound of the interval
  `upper` - upper bound of the interval

### Method Detail

#### getInf

    public double getInf()

Get the lower bound of the interval.

Returns:
  lower bound of the interval
Since:
  3.1

#### getLower

    @Deprecated
    public double getLower()

Deprecated. as of 3.1, replaced by `getInf()`
Get the lower bound of the interval.

Returns:
  lower bound of the interval

#### getSup

    public double getSup()

Get the upper bound of the interval.

Returns:
  upper bound of the interval
Since:
  3.1

#### getUpper

    @Deprecated
    public double getUpper()

Deprecated. as of 3.1, replaced by `getSup()`
Get the upper bound of the interval.

Returns:
  upper bound of the interval

#### getSize

    public double getSize()

Get the size of the interval.

Returns:
  size of the interval
Since:
  3.1

#### getLength

    @Deprecated
    public double getLength()

Deprecated. as of 3.1, replaced by `getSize()`
Get the length of the interval.

Returns:
  length of the interval

#### getBarycenter

    public double getBarycenter()

Get the barycenter of the interval.

Returns:
  barycenter of the interval
Since:
  3.1

#### getMidPoint

    @Deprecated
    public double getMidPoint()

Deprecated. as of 3.1, replaced by `getBarycenter()`
Get the midpoint of the interval.

Returns:
  midpoint of the interval

#### checkPoint

    public Region.Location checkPoint(double point,
                             double tolerance)

Check a point with respect to the interval.

Parameters:
  `point` - point to check
  `tolerance` - tolerance below which points are considered to belong to the boundary
Returns:
  a code representing the point status: either `Region.Location.INSIDE`, `Region.Location.OUTSIDE` or `Region.Location.BOUNDARY`
Since:
  3.1