use of com.cinchapi.ccl.grammar.TimestampSymbol in project concourse by cinchapi.
the class BuiltCriteria method at.
/**
* Return this {@link Criteria} with each expression (e.g. {key} {operator}
* {values}) pinned to the specified {@code timestamp}.
*
* <strong>NOTE:</strong> Any timestamps that are pinned to any expressions
* within this Criteria will be replaced by the specified {@code timestamp}.
*
* @param timestamp the {@link Timestamp} to which the returned
* {@link Criteria} is pinned
*
* @return this {@link Criteria} pinned to {@code timestamp}
*/
public Criteria at(Timestamp timestamp) {
AbstractSyntaxTree ast = ConcourseCompiler.get().parse(ccl());
List<Symbol> symbols = Parsing.groupExpressions(ConcourseCompiler.get().tokenize(ast));
TimestampSymbol ts = new TimestampSymbol(timestamp.getMicros());
symbols.forEach((symbol) -> {
if (symbol instanceof ExpressionSymbol) {
ExpressionSymbol expression = (ExpressionSymbol) symbol;
expression.timestamp(ts);
}
});
BuiltCriteria criteria = new BuiltCriteria();
symbols = Parsing.ungroupExpressions(symbols);
criteria.symbols = symbols;
return criteria;
}
Aggregations