Class Range

java.lang.Object
com.apple.foundationdb.Range

public class Range extends Object
A simple description of an exact range of keyspace, specified by a begin and end key. As with all FoundationDB APIs, begin is inclusive, end exclusive.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final byte[]
    The beginning of the range.
    final byte[]
    The end of the range.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Range(byte[] begin, byte[] end)
    Construct a new Range with an inclusive begin key and an exclusive end key.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the given Object is a Range object that refers to the same key range within the keyspace.
    int
    Computes a hash code from the begin and end keys of this Range.
    static Range
    startsWith(byte[] prefix)
    Returns a Range that describes all possible keys that are prefixed with a specified key.
    Returns a human-readable String representation of this Range.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • begin

      public final byte[] begin
      The beginning of the range. This constraint on the range is inclusive.
    • end

      public final byte[] end
      The end of the range. This constraint on the range is exclusive.
  • Constructor Details

    • Range

      public Range(byte[] begin, byte[] end)
      Construct a new Range with an inclusive begin key and an exclusive end key.
      Parameters:
      begin - the inclusive beginning of the range.
      end - the exclusive end of the range.
  • Method Details

    • startsWith

      public static Range startsWith(byte[] prefix)
      Returns a Range that describes all possible keys that are prefixed with a specified key. Use the result of this call as an input to ReadTransaction.getRange(Range) to replicate the now-removed call Transaction.getRangeStartsWith(k).
      Parameters:
      prefix - the key prefixing the range, must not be null
      Returns:
      the range of keys starting with prefix
    • equals

      public boolean equals(Object o)
      Returns true if the given Object is a Range object that refers to the same key range within the keyspace. This will be true if the given range has the same begin and end key. This will return false if the given Object is not a Range instance.
      Overrides:
      equals in class Object
      Parameters:
      o - the Object to check for equality
      Returns:
      whether the given Object matches this Range
    • hashCode

      public int hashCode()
      Computes a hash code from the begin and end keys of this Range. In particular, it will take the bitwise XOR of the hash of begin with 37 times the hash of end.
      Overrides:
      hashCode in class Object
      Returns:
      hash code derived from the hashes of begin and end
    • toString

      public String toString()
      Returns a human-readable String representation of this Range. It will contain human-readable representations of both the begin and end keys.
      Overrides:
      toString in class Object
      Returns:
      a human-readable representation of this Range