SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.interval
Class Interval<T extends java.lang.Comparable<T>>

java.lang.Object
  extended by com.numericalmethod.suanshu.interval.Interval<T>
Type Parameters:
T - a class that is Comparable; hence a partially ordered set
Direct Known Subclasses:
TimeInterval

public class Interval<T extends java.lang.Comparable<T>>
extends java.lang.Object

This class represents an interval.

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.

This class is immutable.

See Also:
Wikipedia: Interval

Field Summary
 T begin
          the beginning of this interval
 T end
          the end of this interval
 
Constructor Summary
Interval(T begin, T end)
          Construct an interval [begin, end].
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean is(Algebra.Relation relation, Interval<T> Y)
          Check whether this and Y satisfies a certain Algebra.Relation.
 java.util.Set<Algebra.Relation> relations(Interval<T> Y)
          Determine the relations between this and Y.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

begin

public final T extends java.lang.Comparable<T> begin
the beginning of this interval


end

public final T extends java.lang.Comparable<T> end
the end of this interval

Constructor Detail

Interval

public Interval(T begin,
                T end)
Construct an interval [begin, end].

Parameters:
begin - the beginning of this interval
end - the end of this interval
Method Detail

relations

public java.util.Set<Algebra.Relation> relations(Interval<T> Y)
Determine the relations between this and Y.

Parameters:
Y - another Interval
Returns:
the set of applicable relations

is

public boolean is(Algebra.Relation relation,
                  Interval<T> Y)
Check whether this and Y satisfies a certain Algebra.Relation.

Parameters:
relation - a Algebra.Relation
Y - another Interval
Returns:
true iff this and Y satisfies relation

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.