messif.objects.keys
Class KeyInterval<T>

java.lang.Object
  extended by messif.objects.keys.KeyInterval<T>
Type Parameters:
T - specific type of the key
All Implemented Interfaces:
java.lang.Comparable<KeyInterval<T>>
Direct Known Subclasses:
DoubleKeyInterval

public abstract class KeyInterval<T>
extends java.lang.Object
implements java.lang.Comparable<KeyInterval<T>>

Closed interval, comparable by the lower bound.


Constructor Summary
KeyInterval()
           
 
Method Summary
 java.util.List<KeyInterval<T>> cutIntersectingIntervals(java.util.List<KeyInterval<T>> intervals, KeyOperator<T> operator)
          Given a list of intervals, cut from them the parts that intersects with "this" interval.
protected  java.util.List<KeyInterval<T>> cutIntersectingIntervalsInner(java.util.List<KeyInterval<T>> intervals, KeyOperator<T> operator)
          Given a list of intervals, cut from them the parts that intersects with "this" interval.
 boolean equals(java.lang.Object obj)
           
abstract  T getFrom()
          Return the lower bound of the interval.
abstract  T getTo()
          Return the upper bound of the interval.
 int hashCode()
           
 boolean intersect(KeyInterval<T> interval, KeyOperator<T> operator)
          Return true if the interval intersects with this interval.
 boolean isCovered(T key, KeyOperator<T> operator)
          Return true if the interval covers given key.
 java.lang.String toString()
          Return the string representation of this interval.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

KeyInterval

public KeyInterval()
Method Detail

getFrom

public abstract T getFrom()
Return the lower bound of the interval.

Returns:
the lower bound of the interval

getTo

public abstract T getTo()
Return the upper bound of the interval.

Returns:
the upper bound of the interval

isCovered

public final boolean isCovered(T key,
                               KeyOperator<T> operator)
Return true if the interval covers given key.

Parameters:
key - the key to be tested
operator - the operator fot this key type
Returns:
true if the interval covers given key

intersect

public final boolean intersect(KeyInterval<T> interval,
                               KeyOperator<T> operator)
Return true if the interval intersects with this interval.

Parameters:
interval - the interval to be tested
operator - the operator fot this key type
Returns:
true if the interval covers given key

cutIntersectingIntervals

public java.util.List<KeyInterval<T>> cutIntersectingIntervals(java.util.List<KeyInterval<T>> intervals,
                                                               KeyOperator<T> operator)
Given a list of intervals, cut from them the parts that intersects with "this" interval. The intervals can be MODULO the domain size

Parameters:
intervals - list of intervals
operator - the operator fot this key type
Returns:
the list of intervals cut off

cutIntersectingIntervalsInner

protected java.util.List<KeyInterval<T>> cutIntersectingIntervalsInner(java.util.List<KeyInterval<T>> intervals,
                                                                       KeyOperator<T> operator)
Given a list of intervals, cut from them the parts that intersects with "this" interval.

Parameters:
intervals - list of intervals
operator - the operator fot this key type
Returns:
the list of intervals cut off

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()
Return the string representation of this interval.

Overrides:
toString in class java.lang.Object