|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.objects.keys.KeyOperator<T>
T
- specific type of the keypublic abstract class KeyOperator<T>
This class provides an abstract operator for object keys that have a defined order.
The operator must know the maximal and minimal keys and must be able to provide
a successor and predecesor keys. Finally, it should be able to create
key intervals
for the pair of keys.
Constructor Summary | |
---|---|
KeyOperator()
|
Method Summary | |
---|---|
abstract KeyInterval<T> |
createInteral(T from,
T to)
This method creates an interval given two keys. |
abstract T |
getDifference(T first,
T second)
Given two keys, return their distance (difference) |
abstract T |
getMaxKey()
Returns the maximal value of given key type. |
abstract T |
getMiddleKey(T first,
T second)
Given two keys, return the key in the middle. |
abstract T |
getMinKey()
Returns the minimal value of given key type. |
abstract T |
getNextKey(T key)
Given a key, return the smallest key which is greater than the key specified. |
abstract T |
getPreviousKey(T key)
Given a key, return the greatest key which is smaller than the key specified. |
boolean |
intersect(KeyInterval<T> first,
KeyInterval<T> second)
Return true if the two intervals intersect. |
boolean |
isInBetween(T key,
T low,
T up)
Finds out, whether this key is inner the interval specified by the passed bounds - counting on the ring circle (module SIZE). key \in (low, up). |
boolean |
isInBetweenEQ(T key,
T low,
T up)
finds out, whether this key is inner the interval specified by the passed bounds - counting on the ring circle (module SIZE). key \in [low, up] |
boolean |
isInBetweenEQH(T key,
T low,
T up)
Finds out, whether this key is inner the interval specified by the passed bounds - counting on the ring circle (module SIZE). key \in (low, up] |
boolean |
isInBetweenEQL(T key,
T low,
T up)
Finds out, whether this key is inner the interval specified by the passed bounds - counting on the ring circle (module SIZE). key \in [low, up) |
abstract KeyInterval<T> |
makeLeftOpen(KeyInterval<T> interval)
This method returns a new instance of KeyInterval which makes this interval opened from the left. |
T |
max(T first,
T second)
Return the maximum of the two values passed or the first one if they are equal. |
T |
min(T first,
T second)
Return the minimum of the two values passed or the first one if they are equal. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
compare, equals |
Constructor Detail |
---|
public KeyOperator()
Method Detail |
---|
public abstract T getMaxKey()
public abstract T getMinKey()
public abstract T getNextKey(T key)
key
-
key
public abstract T getPreviousKey(T key)
key
-
key
public abstract T getDifference(T first, T second)
first
- the first keysecond
- the second
public abstract T getMiddleKey(T first, T second)
first
- the first keysecond
- the second
public abstract KeyInterval<T> createInteral(T from, T to)
from
- the lower boundto
- the upper bound
public abstract KeyInterval<T> makeLeftOpen(KeyInterval<T> interval)
interval
- the closed interval
public final T max(T first, T second)
first
- the first keysecond
- the second key
public final T min(T first, T second)
first
- the first keysecond
- the second key
public final boolean isInBetween(T key, T low, T up)
key
- the key to be testedlow
- the lower boundup
- the upper bound
public final boolean isInBetweenEQ(T key, T low, T up)
key
- the key to be testedlow
- the lower boundup
- the upper bound
public final boolean isInBetweenEQL(T key, T low, T up)
key
- the key to be testedlow
- the lower boundup
- the upper bound
public final boolean isInBetweenEQH(T key, T low, T up)
key
- the key to be testedlow
- the lower boundup
- the upper bound
public final boolean intersect(KeyInterval<T> first, KeyInterval<T> second)
first
- first intervalsecond
- second interval
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |