パッケージ org.piax.common.subspace
クラス Range<K extends Comparable<?>>
java.lang.Object
org.piax.common.subspace.Range<K>
- 型パラメータ:
K- the type of minimum and maximum keys of the range
- すべての実装されたインタフェース:
Serializable,Cloneable
- 直系の既知のサブクラス:
KeyRange
public class Range<K extends Comparable<?>> extends Object implements Serializable, Cloneable
a class that represents a single range.
- 関連項目:
- 直列化された形式
-
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 KfrombooleanfromInclusiveprotected static KeyComparatorkeyCompKtobooleantoInclusive -
コンストラクタの概要
コンストラクタ コンストラクタ 説明 Range(boolean allowCircular, K from, boolean fromInclusive, K to, boolean toInclusive)construct a range.Range(char fromEdgeSpec, K from, K to, char toEdgeSpec)constructor to allow the form like Range('[', 10, 20, ')');Range(K key)construct [key, key]Range(K from, boolean fromInclusive, K to, boolean toInclusive)construct a rangeRange(K from, K to)construct a non-circular range [from, to] -
メソッドの概要
修飾子とタイプ メソッド 説明 Range<K>clone()booleancontains(Comparable<?> key)returns true if a key is within this range.booleancontains(Range<K> another)check if another range ⊆ this range.booleanequals(Object obj)inthashCode()booleanhasIntersection(Range<K> another)returns if another range intersects this range.booleanisFollowedBy(Range<K> another)returns if this range is immediately followed by another range.booleanisSameRange(Range<K> another)booleanisSingleton()returns whether the range represents [x, x].booleanisWhole()returns whether the range represents [x, x).<T extends Range<K>>
TnewRange(K from, boolean fromInclusive, K to, boolean toInclusive)create a new range.Range<K>newRange(Range<K> another)StringrangeString()<T extends Range<K>>
List<T>retain(Range<K> r, List<T> intersect)returns remaining range(s) when subtracting a specified range from this range.<T extends Range<K>>
List<T>split(K k)split the range with given k.StringtoString()StringtoString2()
-
フィールド詳細
-
keyComp
-
from
-
to
-
fromInclusive
public final boolean fromInclusive -
toInclusive
public final boolean toInclusive
-
-
コンストラクタの詳細
-
Range
construct a non-circular range [from, to]- パラメータ:
from- the minimum key (inclusive)to- the maximum key (inclusive)
-
Range
construct [key, key]- パラメータ:
key- the minimum and maximum key
-
Range
construct a range- パラメータ:
from- the minimum keyfromInclusive- true if from is inclusiveto- the maximum keytoInclusive- true if to is inclusive
-
Range
construct a range. this constructor allows circular ranges such as [1, 0).- パラメータ:
allowCircular- true if circular range is allowedfrom- the minimum keyfromInclusive- true if from is inclusiveto- the maximum keytoInclusive- true if to is inclusive
-
Range
constructor to allow the form like Range('[', 10, 20, ')');- パラメータ:
fromEdgeSpec- the lower-side edge specifier of rangefrom- lower value of the range.to- upper value of the range.toEdgeSpec- the upper-side edge specifier of range
-
-
メソッドの詳細
-
isSingleton
public boolean isSingleton()returns whether the range represents [x, x].- 戻り値:
- true if the range represents [x, x].
-
isWhole
public boolean isWhole()returns whether the range represents [x, x).- 戻り値:
- true if the range represents [x, x).
-
contains
returns true if a key is within this range.- パラメータ:
key- the key to compare with- 戻り値:
- true if the key is within this range.
-
contains
check if another range ⊆ this range.- パラメータ:
another- another range- 戻り値:
- true if this range contains another.
-
toString
-
toString2
-
rangeString
-
isSameRange
-
hashCode
public int hashCode() -
equals
-
split
split the range with given k. if k is included in the range, the results is {#min, k), [k, max#}. otherwise, the results is {#min, max#}. #min is either '(' or '[' and max# is either ')' or ']', depending on the openness of this range.- 型パラメータ:
T- type of the Range class- パラメータ:
k- the key to split- 戻り値:
- the split ranges
-
clone
-
newRange
create a new range.this method is used for creating ranges by methods such as retain().
subclasses must override this method to create an instance of the same class.
- 型パラメータ:
T- the actual type of Range- パラメータ:
from- the minimum keyfromInclusive- true if from is inclusiveto- the maximum keytoInclusive- true if to is inclusive- 戻り値:
- new Range instance
-
newRange
-
retain
returns remaining range(s) when subtracting a specified range from this range. the subtracted range(s) (intersected range) are added to `intersect' if `intersect' is not null. このクラスのサブクラス X から呼び出す場合,返り値の型は List<X> である.example: this: [==========] r: [===] returned: [==) (===] this: [==========] r: [===] returned: [========)
- 型パラメータ:
T- the type of range class- パラメータ:
r- range to subtractintersect- the list to add ranges that intersects with r- 戻り値:
- a list of retained ranges, possibly empty.
-
hasIntersection
returns if another range intersects this range.- パラメータ:
another- another range- 戻り値:
- true if another range intersects this range.
-
isFollowedBy
returns if this range is immediately followed by another range.- パラメータ:
another- another range- 戻り値:
- true if this range is immediately followed by another range.
-