Package dev.nm.interval
Class Interval<T extends Comparable<? super T>>
- java.lang.Object
-
- dev.nm.interval.Interval<T>
-
- Type Parameters:
T
- a class that implementsComparable
; 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. AnInterval
is immutable.- See Also:
- Wikipedia: Interval
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 whetherthis
andY
satisfies a certain Allen's interval relation.Set<IntervalRelation>
relations(Interval<T> Y)
Determine the interval relations betweenthis
andY
.String
toString()
-
-
-
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 betweenthis
andY
.- Parameters:
Y
- an interval- Returns:
- the set of satisfied relations
-
is
public boolean is(IntervalRelation relation, Interval<T> Y)
Check whetherthis
andY
satisfies a certain Allen's interval relation.- Parameters:
relation
- anIntervalRelation
Y
- an interval- Returns:
true
ifthis
andY
satisfiesrelation
-
-