public class IntervalUnion
extends java.lang.Object
Interval
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID
Class identification name with source code version and date.
|
Constructor and Description |
---|
IntervalUnion(double[] values)
Creates a new interval union from an array of values.
|
IntervalUnion(Interval... intervals)
Creates a new interval union from a list of intervals.
|
IntervalUnion(java.util.List<Interval> intervals)
Creates a new interval union from a list of intervals.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double value)
Determines whether an indicated value is within the union of intervals.
|
boolean |
equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.
|
java.lang.String |
format(int decimalPlaces) |
java.util.List<Interval> |
getIntervals()
Gets a collection of the individual intervals of this union.
|
int |
hashCode()
Returns a hash code value for this interval union.
|
double[] |
toArray() |
java.lang.String |
toString()
Gets a string representation for this interval union.
|
public static final java.lang.String ID
public IntervalUnion(java.util.List<Interval> intervals)
The resulting union has redundant intervals removed, and all remaining,
unique intervals are sorted in order of increasing minimum value
and secondarily sorted in order of increasing maximum value
.
intervals
- a list of intervals; may not be null.java.lang.NullPointerException
- if intervals is null or if
any element of intervals is null.java.lang.IllegalArgumentException
- if intervals is empty.public IntervalUnion(Interval... intervals)
The resulting union has redundant intervals removed, and all remaining,
unique intervals are sorted in order of increasing minimum value
and secondarily sorted in order of increasing maximum value
.
intervals
- a list of intervals; may not be null.java.lang.NullPointerException
- if intervals is null or if
any element of intervals is null.java.lang.IllegalArgumentException
- if intervals is empty.public IntervalUnion(double[] values)
The input array is a collection of min, max value pairs, each pair of which describes an interval. Consequently, values must have an even number of elements.
The resulting union has redundant intervals removed, and all remaining,
unique intervals are sorted in order of increasing minimum value
and secondarily sorted in order of increasing maximum value
.
values
- an array of min, max value pairs.java.lang.NullPointerException
- if the array is null.java.lang.IllegalArgumentException
- if the array is empty or if it contains
an odd number of elements, or if any given min is equal to or greater
than its matching max.public java.util.List<Interval> getIntervals()
public boolean contains(double value)
If value is contained by any individual interval, the union is said to contain value. Otherwise it does not.
value
- the value to be tested.Interval.contains(double)
public java.lang.String format(int decimalPlaces)
public double[] toArray()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to which this object is compared.Interval.equals(Object)
Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona