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 classException thrown when range endpoint is not consistent withCONTINUATIONendpoint type. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTupleRange(Tuple low, Tuple high, EndpointType lowEndpoint, EndpointType highEndpoint) -
Method Summary
Modifier and TypeMethodDescriptionstatic TupleRangeCreate aTupleRangeover all keys beginning with a givenTuple.static TupleRangeCreate aTupleRangeover all keys between the givenTuples.static TupleRangebetweenInclusive(Tuple low, Tuple high) Create aTupleRangeover all keys between the givenTuples, including both endpoints.booleanMethod to compute if a givenTupleis contained within this tuple range.booleangetHigh()getLow()inthashCode()booleanisEquals()booleanMethod to compute if an inclusive/inclusive range given by twoTuples overlap with this tuple range.prefix(int prefixCount) Create aTupleRangeover a prefix of the keys of this range.static TupleRangeprefixedBy(String prefixString) Create aTupleRangeover all keys prefixed by someString.Create aTupleRangeover the same keys as this range but prepended by the suppliedTuple.toRange()Convert into a FoundationDBRange.static RangetoRange(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 aTupleRangeover the same keys as this range but prepended by the suppliedTuple. For example, if this range is over allTuples 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- aTupleto prepend to the beginning of this range- Returns:
- a new
TupleRangeover all keys in this range but prepended withbeginning
-
prefix
Create aTupleRangeover a prefix of the keys of this range. For example, if this range is over allTuples from("a", 3)exclusive to("b", 4)inclusive and one calls this method withprefixCountof1, this will create a range from("a")inclusive to("b")inclusive. Note that the newly returnedTupleRangeis guaranteed to encompass the old range.- Parameters:
prefixCount- the number of prefix parts to consider- Returns:
- a new
TupleRangeof a prefix ofpredixCountparts of this tuple range
-
overlaps
Method to compute if an inclusive/inclusive range given by twoTuples overlap with this tuple range.- Parameters:
lowTuple- low tuplehighTuple- high tuple- Returns:
trueif and only if the range[lowTuple, highTuple]overlaps this tuple range
-
contains
Method to compute if a givenTupleis contained within this tuple range.- Parameters:
tuple- tuple- Returns:
trueif and only iftupleis contained within this tuple range
-
allOf
Create aTupleRangeover all keys beginning with a givenTuple. This is a shortcut for creating aTupleRangewithprefixas both the low- and high-endpoint and setting both endpoint types toRANGE_INCLUSIVE.- Parameters:
prefix- theTupleall keys in the returned range should begin with- Returns:
- a
TupleRangecorresponding to keys prefixed byprefix
-
between
Create aTupleRangeover all keys between the givenTuples.- Parameters:
low- the inclusive start of the rangehigh- the exclusive end of the range- Returns:
- a
TupleRangebetweenstartandend
-
betweenInclusive
Create aTupleRangeover all keys between the givenTuples, including both endpoints.- Parameters:
low- the inclusive start of the rangehigh- the inclusive end of the range- Returns:
- a
TupleRangebetweenstartandend, inclusive
-
prefixedBy
Create aTupleRangeover all keys prefixed by someString. This is a shortcut for creating aTupleRangewhere both the low- and high-endpoints areTuples containing a singleStringwhere 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
TupleRangecorresponding 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 thenullendpoints will be replaced withbytearrays representing the beginning or ending of the user-readable keys in FoundationDB (that is, it will not include the system keyspace).- Returns:
- a FoundationDB
Rangeover the same keys as thisTupleRange
-
toRange
Convert into a FoundationDBRange. This adjusts the endpoints of thisTupleRangeand creates aRangeobject 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 theSubspaceprovided. -
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 bothlowBytesandhighBytescould be unpacked intoTuples, this would be equivalent to unpacking them, creating aTupleRangeobject 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
Rangeover the same keys as the provided parameters
-