Package com.apple.foundationdb.record
Class TupleRange
- java.lang.Object
-
- com.apple.foundationdb.record.TupleRange
-
@API(MAINTAINED) public class TupleRange extends Object
A range within a subspace specified by twoTuple
endpoints.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TupleRange.ByteStringBoundException
Exception thrown when range endpoint is not consistent withCONTINUATION
endpoint type.
-
Field Summary
Fields Modifier and Type Field Description static TupleRange
ALL
-
Constructor Summary
Constructors Constructor Description TupleRange(Tuple low, Tuple high, EndpointType lowEndpoint, EndpointType highEndpoint)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TupleRange
allOf(Tuple prefix)
Create aTupleRange
over all keys beginning with a givenTuple
.static TupleRange
between(Tuple low, Tuple high)
Create aTupleRange
over all keys between the givenTuple
s.boolean
equals(Object o)
Tuple
getHigh()
EndpointType
getHighEndpoint()
Tuple
getLow()
EndpointType
getLowEndpoint()
int
hashCode()
boolean
isEquals()
static TupleRange
prefixedBy(String prefixString)
Create aTupleRange
over all keys prefixed by someString
.TupleRange
prepend(Tuple beginning)
Create aTupleRange
over the same keys as this range but prepended by the suppliedTuple
.Range
toRange()
Convert into a FoundationDBRange
.static Range
toRange(byte[] lowBytes, byte[] highBytes, EndpointType lowEndpoint, EndpointType highEndpoint)
Convert a pair of endpoints into a FoundationDBRange
.Range
toRange(Subspace subspace)
Convert into a FoundationDBRange
.String
toString()
protected static String
tupleToString(Tuple t)
-
-
-
Field Detail
-
ALL
public static final TupleRange ALL
-
-
Constructor Detail
-
TupleRange
public TupleRange(@Nullable Tuple low, @Nullable Tuple high, @Nonnull EndpointType lowEndpoint, @Nonnull EndpointType highEndpoint)
-
-
Method Detail
-
getLowEndpoint
@Nonnull public EndpointType getLowEndpoint()
-
getHighEndpoint
@Nonnull public EndpointType getHighEndpoint()
-
isEquals
public boolean isEquals()
-
prepend
@Nonnull public TupleRange prepend(@Nonnull Tuple beginning)
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
-
allOf
@Nonnull public static TupleRange allOf(@Nullable Tuple prefix)
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
public static TupleRange between(@Nullable Tuple low, @Nullable Tuple high)
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
-
prefixedBy
@Nonnull public static TupleRange prefixedBy(@Nonnull String prefixString)
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
@Nonnull public Range 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
@Nonnull public Range toRange(@Nonnull Subspace subspace)
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
-
-