Search in sources :

Example 11 with Symbol

use of com.cinchapi.ccl.grammar.Symbol in project concourse by cinchapi.

the class BuiltCriteria method ccl.

@Override
public String ccl() {
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (Symbol symbol : symbols) {
        if (!first) {
            sb.append(" ");
        }
        sb.append(symbol);
        first = false;
    }
    return sb.toString();
}
Also used : ExpressionSymbol(com.cinchapi.ccl.grammar.ExpressionSymbol) TimestampSymbol(com.cinchapi.ccl.grammar.TimestampSymbol) ParenthesisSymbol(com.cinchapi.ccl.grammar.ParenthesisSymbol) Symbol(com.cinchapi.ccl.grammar.Symbol)

Example 12 with Symbol

use of com.cinchapi.ccl.grammar.Symbol in project concourse by cinchapi.

the class BuiltCriteria method expand.

/**
 * Expand any sub/grouped Criteria.
 *
 * @param symbols
 * @param expanded
 */
private void expand(List<Symbol> symbols, List<Symbol> expanded) {
    for (Symbol symbol : symbols) {
        if (symbol instanceof Criteria) {
            expanded.add(ParenthesisSymbol.LEFT);
            expand(((Criteria) symbol).symbols(), expanded);
            expanded.add(ParenthesisSymbol.RIGHT);
        } else {
            expanded.add(symbol);
        }
    }
}
Also used : ExpressionSymbol(com.cinchapi.ccl.grammar.ExpressionSymbol) TimestampSymbol(com.cinchapi.ccl.grammar.TimestampSymbol) ParenthesisSymbol(com.cinchapi.ccl.grammar.ParenthesisSymbol) Symbol(com.cinchapi.ccl.grammar.Symbol)

Aggregations

Symbol (com.cinchapi.ccl.grammar.Symbol)12 ExpressionSymbol (com.cinchapi.ccl.grammar.ExpressionSymbol)11 ParenthesisSymbol (com.cinchapi.ccl.grammar.ParenthesisSymbol)9 KeySymbol (com.cinchapi.ccl.grammar.KeySymbol)8 Test (org.junit.Test)8 ConjunctionSymbol (com.cinchapi.ccl.grammar.ConjunctionSymbol)6 OperatorSymbol (com.cinchapi.ccl.grammar.OperatorSymbol)6 PostfixNotationSymbol (com.cinchapi.ccl.grammar.PostfixNotationSymbol)6 ValueSymbol (com.cinchapi.ccl.grammar.ValueSymbol)6 Operator (com.cinchapi.concourse.thrift.Operator)5 TimestampSymbol (com.cinchapi.ccl.grammar.TimestampSymbol)3 Timestamp (com.cinchapi.concourse.Timestamp)3 NavigationKeySymbol (com.cinchapi.ccl.grammar.NavigationKeySymbol)2 FunctionValueSymbol (com.cinchapi.ccl.grammar.FunctionValueSymbol)1 AbstractSyntaxTree (com.cinchapi.ccl.syntax.AbstractSyntaxTree)1 Function (com.cinchapi.ccl.type.Function)1 IndexFunction (com.cinchapi.ccl.type.function.IndexFunction)1 KeyConditionFunction (com.cinchapi.ccl.type.function.KeyConditionFunction)1 KeyRecordsFunction (com.cinchapi.ccl.type.function.KeyRecordsFunction)1 TemporalFunction (com.cinchapi.ccl.type.function.TemporalFunction)1