private Token getTokenBound(Bound b, QueryOptions options, IPartitioner p) throws InvalidRequestException { assert onToken; Restriction restriction = keyRestrictions[0]; assert !restriction.isMultiColumn() : "Unexpectedly got a multi-column restriction on a partition key for a range query"; SingleColumnRestriction keyRestriction = (SingleColumnRestriction)restriction; ByteBuffer value; if (keyRestriction.isEQ()) { value = keyRestriction.values(options).get(0); } else { SingleColumnRestriction.Slice slice = (SingleColumnRestriction.Slice)keyRestriction; if (!slice.hasBound(b)) return p.getMinimumToken(); value = slice.bound(b, options); } if (value == null) throw new InvalidRequestException("Invalid null token value"); return p.getTokenFactory().fromByteArray(value); }