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. AnIntervalis immutable.- See Also:
- Wikipedia: Interval
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tbegin()Get the beginning of this interval.Tend()Get the end of this interval.booleanequals(Object obj)inthashCode()booleanis(IntervalRelation relation, Interval<T> Y)Check whetherthisandYsatisfies a certain Allen's interval relation.Set<IntervalRelation>relations(Interval<T> Y)Determine the interval relations betweenthisandY.StringtoString()
-
-
-
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 betweenthisandY.- Parameters:
Y- an interval- Returns:
- the set of satisfied relations
-
is
public boolean is(IntervalRelation relation, Interval<T> Y)
Check whetherthisandYsatisfies a certain Allen's interval relation.- Parameters:
relation- anIntervalRelationY- an interval- Returns:
trueifthisandYsatisfiesrelation
-
-