ShardRange Class
- java.
lang. Object - Comparable<ShardRange>
- com.
microsoft. azure. elasticdb. shard. base. ShardRange
- com.
public class ShardRange
A range of shard keys between a low key and a high key. The low key is inclusive (part of the range) while the high key is exclusive (not part of the range). The ShardRange class is immutable.
Field Summary
Modifier and Type | Field and Description |
---|---|
final Shard |
NULL |
Constructor Summary
Constructor | Description | |
---|---|---|
ShardRange() | ||
ShardRange(ShardKey low, ShardKey high) |
Constructs a shard range from low boundary (inclusive) to high high boundary (exclusive). |
Method Summary
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ShardRange other)
Performs comparison between two shard range values. |
boolean |
contains(ShardKey key)
Checks whether the specified key is inside the range. |
boolean |
contains(ShardRange range)
Checks whether the range is inside the range. |
boolean |
equals(Object obj)
Determines whether the specified object is equal to the current object. |
boolean |
equals(ShardRange other)
Performs equality comparison with another given ShardRange. |
Shard |
getFullRange(ShardKeyType keyType)
Gets a shard range corresponding to a specified key type. |
Shard |
getFullRangeBinary()
Full range that starts from the min value for a key to the max value. |
Shard |
getFullRangeDateTime()
Full range that starts from the min value for a key to the max value. |
Shard |
getFullRangeDateTimeOffset()
Full range that starts from the min value for a key to the max value. |
Shard |
getFullRangeGuid()
Full range that starts from the min value for a key to the max value. |
Shard |
getFullRangeInt32()
Full range that starts from the min value for a key to the max value. |
Shard |
getFullRangeInt64()
Full range that starts from the min value for a key to the max value. |
Shard |
getFullRangeTimeSpan()
Full range that starts from the min value for a key to the max value. |
Shard |
getHigh() |
Shard |
getKeyType() |
Shard |
getLow() |
int |
hashCode()
Calculates the hash code for this instance. |
Shard |
intersect(ShardRange range)
Returns the intersection of two ranges. |
boolean |
intersects(ShardRange range)
Checks whether the range intersects with the current range. |
boolean |
opEquality(ShardRange left, ShardRange right)
Equality operator. |
boolean |
opGreaterThan(ShardRange left, ShardRange right)
Compares two ShardRange using lexicographic order (greater than). |
boolean |
opGreaterThanOrEqual(ShardRange left, ShardRange right)
Compares two ShardRange using lexicographic order (greater or equal). |
boolean |
opInequality(ShardRange left, ShardRange right)
Inequality operator. |
boolean |
opLessThan(ShardRange left, ShardRange right)
Compares two ShardRange using lexicographic order (less than). |
boolean |
opLessThanOrEqual(ShardRange left, ShardRange right)
Compares two ShardRange using lexicographic order (less or equal). |
String |
toString()
Converts the object to its string representation. |
Field Details
NULL
public static final ShardRange NULL= new ShardRange()
Constructor Details
ShardRange
public ShardRange()
ShardRange
public ShardRange(ShardKey low, ShardKey high)
Constructs a shard range from low boundary (inclusive) to high high boundary (exclusive).
Parameters:
Method Details
compareTo
public int compareTo(ShardRange other)
Performs comparison between two shard range values.
Parameters:
Returns:
contains
public boolean contains(ShardKey key)
Checks whether the specified key is inside the range.
Parameters:
Returns:
contains
public boolean contains(ShardRange range)
Checks whether the range is inside the range.
Parameters:
Returns:
equals
public boolean equals(Object obj)
Determines whether the specified object is equal to the current object.
Parameters:
Returns:
equals
public boolean equals(ShardRange other)
Performs equality comparison with another given ShardRange.
Parameters:
Returns:
getFullRange
public static ShardRange getFullRange(ShardKeyType keyType)
Gets a shard range corresponding to a specified key type.
Parameters:
Returns:
getFullRangeBinary
public static ShardRange getFullRangeBinary()
Full range that starts from the min value for a key to the max value.
getFullRangeDateTime
public static ShardRange getFullRangeDateTime()
Full range that starts from the min value for a key to the max value.
getFullRangeDateTimeOffset
public static ShardRange getFullRangeDateTimeOffset()
Full range that starts from the min value for a key to the max value.
getFullRangeGuid
public static ShardRange getFullRangeGuid()
Full range that starts from the min value for a key to the max value.
getFullRangeInt32
public static ShardRange getFullRangeInt32()
Full range that starts from the min value for a key to the max value.
getFullRangeInt64
public static ShardRange getFullRangeInt64()
Full range that starts from the min value for a key to the max value.
getFullRangeTimeSpan
public static ShardRange getFullRangeTimeSpan()
Full range that starts from the min value for a key to the max value.
getHigh
public ShardKey getHigh()
getKeyType
public ShardKeyType getKeyType()
getLow
public ShardKey getLow()
hashCode
public int hashCode()
Calculates the hash code for this instance.
Returns:
intersect
public ShardRange intersect(ShardRange range)
Returns the intersection of two ranges.
Parameters:
Returns:
intersects
public boolean intersects(ShardRange range)
Checks whether the range intersects with the current range.
Parameters:
Returns:
opEquality
public static boolean opEquality(ShardRange left, ShardRange right)
Equality operator.
Parameters:
Returns:
opGreaterThan
public static boolean opGreaterThan(ShardRange left, ShardRange right)
Compares two ShardRange using lexicographic order (greater than).
Parameters:
Returns:
opGreaterThanOrEqual
public static boolean opGreaterThanOrEqual(ShardRange left, ShardRange right)
Compares two ShardRange using lexicographic order (greater or equal).
Parameters:
Returns:
opInequality
public static boolean opInequality(ShardRange left, ShardRange right)
Inequality operator.
Parameters:
Returns:
opLessThan
public static boolean opLessThan(ShardRange left, ShardRange right)
Compares two ShardRange using lexicographic order (less than).
Parameters:
Returns:
opLessThanOrEqual
public static boolean opLessThanOrEqual(ShardRange left, ShardRange right)
Compares two ShardRange using lexicographic order (less or equal).
Parameters:
Returns:
toString
public String toString()
Converts the object to its string representation.
Returns: