T
- specific type of the keypublic abstract class KeyOperator<T extends java.lang.Comparable<? super T>>
extends java.lang.Object
implements java.util.Comparator<T>
key intervals
for the pair of keys.Constructor and Description |
---|
KeyOperator() |
Modifier and Type | Method and Description |
---|---|
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.
|
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 secondpublic abstract T getMiddleKey(T first, T second)
first
- the first keysecond
- the secondpublic abstract KeyInterval<T> createInteral(T from, T to)
from
- the lower boundto
- the upper boundpublic abstract KeyInterval<T> makeLeftOpen(KeyInterval<T> interval)
interval
- the closed intervalpublic final T max(T first, T second)
first
- the first keysecond
- the second keypublic final T min(T first, T second)
first
- the first keysecond
- the second keypublic final boolean isInBetween(T key, T low, T up)
key
- the key to be testedlow
- the lower boundup
- the upper boundpublic final boolean isInBetweenEQ(T key, T low, T up)
key
- the key to be testedlow
- the lower boundup
- the upper boundpublic final boolean isInBetweenEQL(T key, T low, T up)
key
- the key to be testedlow
- the lower boundup
- the upper boundpublic final boolean isInBetweenEQH(T key, T low, T up)
key
- the key to be testedlow
- the lower boundup
- the upper boundpublic final boolean intersect(KeyInterval<T> first, KeyInterval<T> second)
first
- first intervalsecond
- second interval