kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 0aeacc35956c58c5a3bd09517861a399e16fe1a8fe7db258298b1b5b54a56f32 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2015-03-11 20:15 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2015-03-11 20:18 +01:00 |
| Parents | a30aaa55e581 |
2 files changed
modified driver-core/CHANGELOG.rst +1 −0
| @@ -17,6 +17,7 @@ | ||
| 17 | 17 | - [bug] Quote single quotes contained in table comments in asCQLQuery method |
| 18 | 18 | (JAVA-655) |
| 19 | 19 | - [bug] Empty TokenRange returned in a one token cluster (JAVA-684) |
| 20 | +- [improvement] Expose TokenRange#contains (JAVA-687) | |
| 20 | 21 | |
| 21 | 22 | Merged from 2.0.9_fixes branch: |
| 22 | 23 |
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] |