edu.umd.cfar.lamp.viper.util
Interface Interval

All Known Subinterfaces:
DynamicAttributeValue, DynamicValue, InstantInterval
All Known Implementing Classes:
AbstractInstantInterval, AbstractInterval, SimpleInterval, TemporalObject, TimeEncodedList.DynamicAttributeValueImpl

public interface Interval

Stores an ordered pair of comparable objects that together describe a half-open interval.


Method Summary
 Interval change(java.lang.Comparable start, java.lang.Comparable stop)
          Since an Interval is designed to be immutable, you need this thing to change the interval.
 boolean contains(java.lang.Comparable i)
          Checks to see if this interval contains the given element.
 boolean contains(Interval other)
          Checks to see if the other interval is a subset of this one.
 boolean contains(java.util.Set s)
          Checks to see if this contains all elements of the set.
 java.lang.Comparable getEnd()
          Gets the end of the interval, which is not an element of the interval.
 java.lang.Comparable getStart()
          Gets the start of the interval.
 boolean intersects(Interval other)
          Tests to see that the two intervals have some shared element(s).
 boolean intersects(java.util.Set s)
          Tests to see if any elements of the set are elements of the interval.
 boolean isEmpty()
          Tests to see if an object exists that this Interval contains.
 

Method Detail

getStart

public java.lang.Comparable getStart()
Gets the start of the interval.

Returns:
first element in the interval

getEnd

public java.lang.Comparable getEnd()
Gets the end of the interval, which is not an element of the interval.

Returns:
the first element after the interval

isEmpty

public boolean isEmpty()
Tests to see if an object exists that this Interval contains.

Returns:
true if the interval is non-empty

intersects

public boolean intersects(java.util.Set s)
Tests to see if any elements of the set are elements of the interval.

Parameters:
s - set of Comparable objects to the interval, or other Intervals.
Returns:
boolean true when some element of the set is contained within or intersects this interval

intersects

public boolean intersects(Interval other)
Tests to see that the two intervals have some shared element(s).

Parameters:
other - the interval to check against
Returns:
true if the intervals intersect.

contains

public boolean contains(java.lang.Comparable i)
Checks to see if this interval contains the given element.

Parameters:
i -
Returns:

contains

public boolean contains(Interval other)
Checks to see if the other interval is a subset of this one.

Parameters:
other - the interval to check
Returns:
true if other contains only elements that are elements of this

contains

public boolean contains(java.util.Set s)
Checks to see if this contains all elements of the set.

Parameters:
s - the set to test
Returns:
true if s contains only elements that are elements or subsets of this

change

public Interval change(java.lang.Comparable start,
                       java.lang.Comparable stop)
Since an Interval is designed to be immutable, you need this thing to change the interval.

Parameters:
start - the first element
stop - the element after the last elment; all elements of the interval are strictly less than this.
Returns:
A copy of this Interval with the new start and stop