kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | a6a6cec35afb087814efb22e37836ec2c3fdaffeb2564f55775704d2c23b1824 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2015-03-11 20:19 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2015-03-11 20:19 +01:00 |
| Parents | fbd0ca059df8, 0aeacc35956c |
2 files changed
modified driver-core/CHANGELOG.rst +1 −0
| @@ -24,6 +24,7 @@ | ||
| 24 | 24 | - [bug] Quote single quotes contained in table comments in asCQLQuery method |
| 25 | 25 | (JAVA-655) |
| 26 | 26 | - [bug] Empty TokenRange returned in a one token cluster (JAVA-684) |
| 27 | +- [improvement] Expose TokenRange#contains (JAVA-687) | |
| 27 | 28 | - [bug] Prevent race between cancellation and query completion (JAVA-614) |
| 28 | 29 | - [bug] Prevent cancel and timeout from cancelling unrelated ResponseHandler if |
| 29 | 30 | streamId was already released and reused (JAVA-632). |
modified driver-core/src/main/java/com/datastax/driver/core/TokenRange.java +10 −0
| @@ -213,6 +213,16 @@ | ||
| 213 | 213 | return intersected; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | + /** | |
| 217 | + * Checks whether this range contains a given token. | |
| 218 | + * | |
| 219 | + * @param token the token to check for. | |
| 220 | + * @return whether this range contains the token, i.e. {@code range.start < token <= range.end}. | |
| 221 | + */ | |
| 222 | + public boolean contains(Token token) { | |
| 223 | + return contains(token, false); | |
| 224 | + } | |
| 225 | + | |
| 216 | 226 | // isStart handles the case where the token is the start of another range, for example: |
| 217 | 227 | // * ]1,2] contains 2, but it does not contain the start of ]2,3] |
| 218 | 228 | // * ]1,2] does not contain 1, but it contains the start of ]1,3] |