Package com.apple.foundationdb.record
Class TupleRange
java.lang.Object
com.apple.foundationdb.record.TupleRange
A range within a subspace specified by two
Tuple
endpoints.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Exception thrown when range endpoint is not consistent withCONTINUATION
endpoint type. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTupleRange
(Tuple low, Tuple high, EndpointType lowEndpoint, EndpointType highEndpoint) -
Method Summary
Modifier and TypeMethodDescriptionstatic TupleRange
Create aTupleRange
over all keys beginning with a givenTuple
.static TupleRange
Create aTupleRange
over all keys between the givenTuple
s.static TupleRange
betweenInclusive
(Tuple low, Tuple high) Create aTupleRange
over all keys between the givenTuple
s, including both endpoints.boolean
Method to compute if a givenTuple
is contained within this tuple range.boolean
getHigh()
getLow()
int
hashCode()
boolean
isEquals()
boolean
Method to compute if an inclusive/inclusive range given by twoTuple
s overlap with this tuple range.prefix
(int prefixCount) Create aTupleRange
over a prefix of the keys of this range.static TupleRange
prefixedBy
(String prefixString) Create aTupleRange
over all keys prefixed by someString
.Create aTupleRange
over the same keys as this range but prepended by the suppliedTuple
.toRange()
Convert into a FoundationDBRange
.static Range
toRange
(byte[] lowBytes, byte[] highBytes, EndpointType lowEndpoint, EndpointType highEndpoint) Convert a pair of endpoints into a FoundationDBRange
.Convert into a FoundationDBRange
.toString()
protected static String
-
Field Details
-
ALL
-
-
Constructor Details
-
TupleRange
public TupleRange(@Nullable Tuple low, @Nullable Tuple high, @Nonnull EndpointType lowEndpoint, @Nonnull EndpointType highEndpoint)
-
-
Method Details
-
getLow
-
getHigh
-
getLowEndpoint
-
getHighEndpoint
-
equals
-
hashCode
public int hashCode() -
toString
-
tupleToString
-
isEquals
public boolean isEquals() -
prepend
Create aTupleRange
over the same keys as this range but prepended by the suppliedTuple
. For example, if this range is over allTuple
s from("a", 3)
exclusive to("b", 4)
inclusive and one calls this method with(0, null)
as the argument, this will create a range from(0, null, "a", 3)
exclusive to(0, null, "b", 4)
inclusive.- Parameters:
beginning
- aTuple
to prepend to the beginning of this range- Returns:
- a new
TupleRange
over all keys in this range but prepended withbeginning
-
prefix
Create aTupleRange
over a prefix of the keys of this range. For example, if this range is over allTuple
s from("a", 3)
exclusive to("b", 4)
inclusive and one calls this method withprefixCount
of1
, this will create a range from("a")
inclusive to("b")
inclusive. Note that the newly returnedTupleRange
is guaranteed to encompass the old range.- Parameters:
prefixCount
- the number of prefix parts to consider- Returns:
- a new
TupleRange
of a prefix ofpredixCount
parts of this tuple range
-
overlaps
Method to compute if an inclusive/inclusive range given by twoTuple
s overlap with this tuple range.- Parameters:
lowTuple
- low tuplehighTuple
- high tuple- Returns:
true
if and only if the range[lowTuple, highTuple]
overlaps this tuple range
-
contains
Method to compute if a givenTuple
is contained within this tuple range.- Parameters:
tuple
- tuple- Returns:
true
if and only iftuple
is contained within this tuple range
-
allOf
Create aTupleRange
over all keys beginning with a givenTuple
. This is a shortcut for creating aTupleRange
withprefix
as both the low- and high-endpoint and setting both endpoint types toRANGE_INCLUSIVE
.- Parameters:
prefix
- theTuple
all keys in the returned range should begin with- Returns:
- a
TupleRange
corresponding to keys prefixed byprefix
-
between
Create aTupleRange
over all keys between the givenTuple
s.- Parameters:
low
- the inclusive start of the rangehigh
- the exclusive end of the range- Returns:
- a
TupleRange
betweenstart
andend
-
betweenInclusive
Create aTupleRange
over all keys between the givenTuple
s, including both endpoints.- Parameters:
low
- the inclusive start of the rangehigh
- the inclusive end of the range- Returns:
- a
TupleRange
betweenstart
andend
, inclusive
-
prefixedBy
Create aTupleRange
over all keys prefixed by someString
. This is a shortcut for creating aTupleRange
where both the low- and high-endpoints areTuple
s containing a singleString
where both the low and high endpoint types arePREFIX_STRING
.- Parameters:
prefixString
- the string that the keys in the returned range will have as a prefix- Returns:
- a
TupleRange
corresponding to keys prefixed byprefixString
-
toRange
Convert into a FoundationDBRange
. This behaves just like the version oftoRange()
that takes aSubspace
, but this version does not prefix the resulting range with anything. If either endpoint isnull
, then thenull
endpoints will be replaced withbyte
arrays representing the beginning or ending of the user-readable keys in FoundationDB (that is, it will not include the system keyspace).- Returns:
- a FoundationDB
Range
over the same keys as thisTupleRange
-
toRange
Convert into a FoundationDBRange
. This adjusts the endpoints of thisTupleRange
and creates aRange
object that spans over the same range of keys. This range can be passed toTrasaction.getRange()
, for example. As with all other ranges in FoundationDB, the resulting range will include its beginning endpoint but exclude its ending endpoint. The range produced will be prefixed by theSubspace
provided. -
toRange
@Nonnull public static Range toRange(@Nullable byte[] lowBytes, @Nullable byte[] highBytes, @Nonnull EndpointType lowEndpoint, @Nonnull EndpointType highEndpoint) Convert a pair of endpoints into a FoundationDBRange
. If bothlowBytes
andhighBytes
could be unpacked intoTuple
s, this would be equivalent to unpacking them, creating aTupleRange
object out of them, and then callingtoRange()
on the resultingTupleRange
.- Parameters:
lowBytes
- the beginning of the rangehighBytes
- the end of the rangelowEndpoint
- the type (inclusive, exclusive, etc.) of the low endpointhighEndpoint
- the type (inclusive, exclusive, etc.) of the high endpoint- Returns:
- a FoundationDB
Range
over the same keys as the provided parameters
-