org.jscience.mathematics.analysis
Class Interval

java.lang.Object
  extended by org.jscience.mathematics.analysis.Interval
All Implemented Interfaces:
Set

public class Interval
extends java.lang.Object
implements Set

A class representing an interval on N, Q, R...


Field Summary
static Interval EMPTY
           
 
Constructor Summary
Interval(ComparableNumber startValue, ComparableNumber endValue)
           
Interval(Interval i)
          Creates a new Interval object.
 
Method Summary
 int cardinality()
          Returns the cardinality (the number of elements).
 boolean contains(ComparableNumber value)
           
 boolean contains(Interval interval)
           
 boolean contains(java.lang.Object o)
          Returns true if this set contains the specified element.
 boolean equals(java.lang.Object o)
          DOCUMENT ME!
 java.lang.Class getDomain()
           
 ComparableNumber getInf()
          DOCUMENT ME!
 ComparableNumber getSup()
          DOCUMENT ME!
 boolean happensAfter(Interval interval)
           
 boolean happensBefore(Interval interval)
           
 int hashCode()
          Returns the hash code value for this set.
 Set intersection(Set set)
          Performs the intersection of this set with another.
 boolean intersects(Interval interval)
           
 boolean isEmpty()
          Returns true if this set contains no elements.
 boolean isIncluded(Interval interval)
          DOCUMENT ME!
 boolean isInfBoundIncluded()
          DOCUMENT ME!
 boolean isSupBoundIncluded()
          DOCUMENT ME!
 java.util.Iterator iterator()
          Returns an iterator over the elements in this set.
 ComparableNumber length()
          Returns the length between bounds.
 boolean overlaps(Interval interval)
           
 Set remove(ComparableNumber c)
          Removes the specified element from this set if it is present.
 Set remove(Interval i)
          Removes the specified interval from this set if it is present.
 boolean remove(java.lang.Object o)
          Removes the specified element from this set if it is present (optional operation).
 void setBoundValues(boolean included1, boolean included2)
           
 void setInfBoundValue(boolean included)
           
 void setSupBoundValue(boolean included)
           
 java.lang.Object[] toArray()
          Returns an array containing all of the elements in this set.
 java.lang.String toString()
          Returns a string representing this set.
 Set union(Set set)
          Performs the union of this set with another.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final Interval EMPTY
Constructor Detail

Interval

public Interval(ComparableNumber startValue,
                ComparableNumber endValue)

Interval

public Interval(Interval i)
Creates a new Interval object.

Parameters:
i - DOCUMENT ME!
Method Detail

getInf

public ComparableNumber getInf()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isInfBoundIncluded

public boolean isInfBoundIncluded()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setInfBoundValue

public void setInfBoundValue(boolean included)

getSup

public ComparableNumber getSup()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isSupBoundIncluded

public boolean isSupBoundIncluded()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setSupBoundValue

public void setSupBoundValue(boolean included)

setBoundValues

public void setBoundValues(boolean included1,
                           boolean included2)

length

public ComparableNumber length()
Returns the length between bounds. Should be a positive value, as bounds are reordered so that startValue
Returns:
DOCUMENT ME!

isEmpty

public boolean isEmpty()
Description copied from interface: Set
Returns true if this set contains no elements.

Specified by:
isEmpty in interface Set
Returns:
true if this set contains no elements.

getDomain

public java.lang.Class getDomain()

contains

public boolean contains(java.lang.Object o)
Returns true if this set contains the specified element.

Specified by:
contains in interface Set
Parameters:
o - - element whose presence in this set is to be tested.
Returns:
true if this set contains the specified element.

contains

public boolean contains(Interval interval)
Parameters:
interval - DOCUMENT ME!
Returns:
DOCUMENT ME!

contains

public boolean contains(ComparableNumber value)
Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

happensBefore

public boolean happensBefore(Interval interval)

happensAfter

public boolean happensAfter(Interval interval)

isIncluded

public boolean isIncluded(Interval interval)
DOCUMENT ME!

Parameters:
interval - DOCUMENT ME!
Returns:
DOCUMENT ME!

overlaps

public boolean overlaps(Interval interval)

intersects

public boolean intersects(Interval interval)

cardinality

public int cardinality()
Returns the cardinality (the number of elements).

Specified by:
cardinality in interface Set
Returns:
the number of elements in this set (its cardinality).

intersection

public Set intersection(Set set)
Description copied from interface: Set
Performs the intersection of this set with another.

Specified by:
intersection in interface Set
Parameters:
set - a set.
Returns:
the intersection of the two sets.

union

public Set union(Set set)
Description copied from interface: Set
Performs the union of this set with another.

Specified by:
union in interface Set
Parameters:
set - a set.
Returns:
the union of the two sets.

remove

public boolean remove(java.lang.Object o)
Removes the specified element from this set if it is present (optional operation).

Specified by:
remove in interface Set
Parameters:
o - - object to be removed from this set, if present.
Returns:
true if the set contained the specified element.

remove

public Set remove(ComparableNumber c)
Removes the specified element from this set if it is present.

Parameters:
c - - ComparableNumber to be removed from this set, if present.
Returns:
a set of intervals.

remove

public Set remove(Interval i)
Removes the specified interval from this set if it is present.

Parameters:
i - - Interval to be removed from this set, if present.
Returns:
a set of intervals.

equals

public boolean equals(java.lang.Object o)
DOCUMENT ME!

Specified by:
equals in interface Set
Overrides:
equals in class java.lang.Object
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!

hashCode

public int hashCode()
Returns the hash code value for this set.

Specified by:
hashCode in interface Set
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code value for this set.

toString

public java.lang.String toString()
Returns a string representing this set.

Overrides:
toString in class java.lang.Object

iterator

public java.util.Iterator iterator()
Returns an iterator over the elements in this set.

Specified by:
iterator in interface Set
Returns:
an iterator over the elements in this set.

toArray

public java.lang.Object[] toArray()
Returns an array containing all of the elements in this set.

Specified by:
toArray in interface Set
Returns:
an array containing all of the elements in this set.