de.unima.alcomox.ontology
Class Interval

java.lang.Object
  extended by de.unima.alcomox.ontology.Interval
All Implemented Interfaces:
java.lang.Comparable<Interval>

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

An interval represents a sub branch of classes in an interval tree.


Constructor Summary
Interval(int lower)
          Constructs an interval be explicitly defining the lower border, while the upper border is set to -1 to mark the interval as an open interval.
Interval(int lower, int upper)
           
 
Method Summary
 int compareTo(Interval that)
           
 boolean contains(int index)
          Checks whether an index is contained in this interval.
 boolean contains(Interval that)
          Compares this and that interval and checks whether this interval contains that interval.
 boolean equals(java.lang.Object that)
           
 int getId()
           
 int getLower()
           
 int getUpper()
           
 boolean isClosed()
           
 boolean overlaps(Interval that)
          Compares this and that interval and checks whether this overlaps with that (see also the cases in the in line comments).
 void setLower(int lower)
           
 void setUpper(int upper)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Interval

public Interval(int lower)
Constructs an interval be explicitly defining the lower border, while the upper border is set to -1 to mark the interval as an open interval.

Parameters:
lower - The lower border (inclusive) of the interval.

Interval

public Interval(int lower,
                int upper)
Method Detail

setLower

public void setLower(int lower)

setUpper

public void setUpper(int upper)

getLower

public int getLower()

getUpper

public int getUpper()

isClosed

public boolean isClosed()

getId

public int getId()

toString

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

equals

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

overlaps

public boolean overlaps(Interval that)
Compares this and that interval and checks whether this overlaps with that (see also the cases in the in line comments). The method is symmetric.

Parameters:
that - Another interval.
Returns:
True if this interval has a common element with that interval, false otherwise.

contains

public boolean contains(Interval that)
Compares this and that interval and checks whether this interval contains that interval. In case that one of the intervals is not yet closed the method returns false.

Parameters:
that - Another interval.
Returns:
True if this contains that, false otherwise.

contains

public boolean contains(int index)
Checks whether an index is contained in this interval.

Parameters:
index - Some index used in an interval tree.
Returns:
True if the index is contained in this interval, false otherwise.

compareTo

public int compareTo(Interval that)
Specified by:
compareTo in interface java.lang.Comparable<Interval>