SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.interval

Class Interval<T extends Comparable<? super T>>

• Type Parameters:
T - a class that implements Comparable; hence a partially ordered set
Direct Known Subclasses:
RealInterval, TimeInterval

public class Interval<T extends Comparable<? super T>>
extends Object
For a partially ordered set, there is a binary relation, denoted as ≤, that indicates that, for certain pairs of elements in the set, one of the elements precedes the other. An interval is defined as follows. For a ≤ b, an interval [a,b] is the set of elements x satisfying a ≤ x ≤ b (i.e. a ≤ x and x ≤ b). It contains at least the elements a and b.

An Interval is immutable.

Wikipedia: Interval
• Constructor Summary

Constructors
Constructor and Description
Interval(T begin, T end)
Construct an interval.
• Method Summary

All Methods
Modifier and Type Method and Description
T begin()
Get the beginning of this interval.
T end()
Get the end of this interval.
boolean equals(Object obj)
int hashCode()
boolean is(IntervalRelation relation, Interval<T> Y)
Check whether this and Y satisfies a certain Allen's interval relation.
Set<IntervalRelation> relations(Interval<T> Y)
Determine the interval relations between this and Y.
String toString()
• Methods inherited from class java.lang.Object

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

• Interval

public Interval(T begin,
T end)
Construct an interval.
Parameters:
begin - the beginning of this interval
end - the end of this interval
• Method Detail

• begin

public T begin()
Get the beginning of this interval.
Returns:
the beginning of this interval
• end

public T end()
Get the end of this interval.
Returns:
the end of this interval
• relations

public Set<IntervalRelation> relations(Interval<T> Y)
Determine the interval relations between this and Y.
Parameters:
Y - an interval
Returns:
the set of satisfied relations
• is

public boolean is(IntervalRelation relation,
Interval<T> Y)
Check whether this and Y satisfies a certain Allen's interval relation.
Parameters:
relation - an IntervalRelation
Y - an interval
Returns:
true if this and Y satisfies relation
• equals

public boolean equals(Object obj)
Overrides:
equals in class Object
• hashCode

public int hashCode()
Overrides:
hashCode in class Object
• toString

public String toString()
Overrides:
toString in class Object