From 7df2a86209b069fac2f066fd4488eabda987ce68 Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Thu, 22 Jan 2015 14:28:22 +0100 Subject: [PATCH] cql3: Convert restrictions/Restriction.java to C++ --- .../{Restriction.java => restriction.hh} | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) rename cql3/restrictions/{Restriction.java => restriction.hh} (75%) diff --git a/cql3/restrictions/Restriction.java b/cql3/restrictions/restriction.hh similarity index 75% rename from cql3/restrictions/Restriction.java rename to cql3/restrictions/restriction.hh index d0ed1932e9..eab086e835 100644 --- a/cql3/restrictions/Restriction.java +++ b/cql3/restrictions/restriction.hh @@ -15,31 +15,39 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.cassandra.cql3.restrictions; -import java.nio.ByteBuffer; -import java.util.List; +/* + * Copyright 2015 Cloudius Systems + * + * Modified by Cloudius Systems + */ -import org.apache.cassandra.cql3.QueryOptions; -import org.apache.cassandra.cql3.statements.Bound; -import org.apache.cassandra.db.IndexExpression; -import org.apache.cassandra.db.index.SecondaryIndexManager; -import org.apache.cassandra.exceptions.InvalidRequestException; +#pragma once + +#include + +#include "cql3/query_options.hh" +#include "cql3/statements/bound.hh" +#include "database.hh" + +namespace cql3 { + +namespace restrictions { /** * A restriction/clause on a column. * The goal of this class being to group all conditions for a column in a SELECT. */ -public interface Restriction -{ - public boolean isOnToken(); - public boolean isSlice(); - public boolean isEQ(); - public boolean isIN(); - public boolean isContains(); - public boolean isMultiColumn(); +class restriction { +public: + virtual bool is_on_token() = 0; + virtual bool is_slice() = 0; + virtual bool is_EQ() = 0; + virtual bool is_IN() = 0; + virtual bool is_contains() = 0; + virtual bool is_multi_column() = 0; - public List values(QueryOptions options) throws InvalidRequestException; + virtual std::vector values(const query_options& options) = 0; /** * Returns true if one of the restrictions use the specified function. @@ -48,24 +56,25 @@ public interface Restriction * @param functionName the function name * @return true if one of the restrictions use the specified function, false otherwise. */ - public boolean usesFunction(String ksName, String functionName); + virtual bool uses_function(sstring ksName, sstring functionName) = 0; /** * Checks if the specified bound is set or not. * @param b the bound type * @return true if the specified bound is set, false otherwise */ - public boolean hasBound(Bound b); + virtual bool has_bound(statements::bound b) = 0; - public List bounds(Bound b, QueryOptions options) throws InvalidRequestException; + virtual std::vector bounds(statements::bound b, const query_options& options) = 0; /** * Checks if the specified bound is inclusive or not. * @param b the bound type * @return true if the specified bound is inclusive, false otherwise */ - public boolean isInclusive(Bound b); + virtual bool is_inclusive(statements::bound b) = 0; +#if 0 /** * Merges this restriction with the specified one. * @@ -94,4 +103,9 @@ public interface Restriction public void addIndexExpressionTo(List expressions, QueryOptions options) throws InvalidRequestException; +#endif +}; + +} + }