public SliceRestriction( CFMetaData cfm, List<ColumnDefinition> columnDefs, Bound bound, boolean inclusive, Term term) { super(cfm, columnDefs); slice = TermSlice.newInstance(bound, inclusive, term); }
@Override protected PrimaryKeyRestrictions doMergeWith(TokenRestriction otherRestriction) throws InvalidRequestException { if (!otherRestriction.isSlice()) throw invalidRequest( "Columns \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnNamesAsString()); TokenRestriction.SliceRestriction otherSlice = (TokenRestriction.SliceRestriction) otherRestriction; if (hasBound(Bound.START) && otherSlice.hasBound(Bound.START)) throw invalidRequest( "More than one restriction was found for the start bound on %s", getColumnNamesAsString()); if (hasBound(Bound.END) && otherSlice.hasBound(Bound.END)) throw invalidRequest( "More than one restriction was found for the end bound on %s", getColumnNamesAsString()); return new SliceRestriction(metadata, columnDefs, slice.merge(otherSlice.slice)); }
@Override public boolean isInclusive(Bound b) { return slice.isInclusive(b); }
@Override public Iterable<Function> getFunctions() { return slice.getFunctions(); }
@Override public List<ByteBuffer> bounds(Bound b, QueryOptions options) throws InvalidRequestException { return Collections.singletonList(slice.bound(b).bindAndGet(options)); }
@Override public boolean hasBound(Bound b) { return slice.hasBound(b); }