use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class ConfiguredObjectFilterParser method multExpr.
public final Expression multExpr() throws ParseException {
Expression left;
Expression right;
left = unaryExpr();
label_8: while (true) {
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 42:
case 43:
case 44:
;
break;
default:
break label_8;
}
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 42:
jj_consume_token(42);
right = unaryExpr();
left = ArithmeticExpression.createMultiply(left, right);
break;
case 43:
jj_consume_token(43);
right = unaryExpr();
left = ArithmeticExpression.createDivide(left, right);
break;
case 44:
jj_consume_token(44);
right = unaryExpr();
left = ArithmeticExpression.createMod(left, right);
break;
default:
jj_consume_token(-1);
throw new ParseException();
}
}
{
if (true)
return left;
}
throw new Error("Missing return statement in function");
}
use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class ConfiguredObjectFilterParser method equalityExpression.
public final Expression equalityExpression() throws ParseException {
Expression left;
Expression right;
left = comparisonExpression();
label_3: while (true) {
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case IS:
case 31:
case 32:
;
break;
default:
break label_3;
}
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 31:
jj_consume_token(31);
right = comparisonExpression();
left = ComparisonExpression.createEqual(left, right);
break;
case 32:
jj_consume_token(32);
right = comparisonExpression();
left = ComparisonExpression.createNotEqual(left, right);
break;
default:
if (jj_2_1(2)) {
jj_consume_token(IS);
jj_consume_token(NULL);
left = ComparisonExpression.createIsNull(left);
} else {
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case IS:
jj_consume_token(IS);
jj_consume_token(NOT);
jj_consume_token(NULL);
left = ComparisonExpression.createIsNotNull(left);
break;
default:
jj_consume_token(-1);
throw new ParseException();
}
}
}
}
{
if (true)
return left;
}
throw new Error("Missing return statement in function");
}
use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class ConfiguredObjectQuery method parseSelectClause.
private HeadersAndValueExpressions parseSelectClause(final String selectClause) {
final List<String> headers = new ArrayList<>();
final List<Expression> valueExpressions = new ArrayList<>();
if (selectClause != null) {
ConfiguredObjectFilterParser parser = new ConfiguredObjectFilterParser();
parser.setConfiguredObjectExpressionFactory(_expressionFactory);
try {
final List<Map<String, Expression>> expressions = parser.parseSelect(selectClause);
for (Map<String, Expression> expression : expressions) {
final Map.Entry<String, Expression> entry = expression.entrySet().iterator().next();
headers.add(entry.getKey());
valueExpressions.add(entry.getValue());
}
} catch (ParseException | TokenMgrError e) {
throw new SelectorParsingException("Unable to parse select clause", e);
}
} else {
for (String field : STANDARD_FIELDS) {
headers.add(field);
valueExpressions.add(_expressionFactory.createConfiguredObjectExpression(field));
}
}
return new HeadersAndValueExpressions() {
@Override
public List<String> getHeaders() {
return Collections.unmodifiableList(headers);
}
@Override
public List<Expression> getValueExpressions() {
return Collections.unmodifiableList(valueExpressions);
}
@Override
public boolean hasHeader(final String headerName) {
return headers.contains(headerName);
}
@Override
public Expression getValueExpressionForHeader(final String headerName) {
final int i = headers.indexOf(headerName);
if (i < 0) {
throw new IllegalStateException(String.format("No expression found for header '%s'", headerName));
}
return valueExpressions.get(i);
}
};
}
use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class SelectorParser method addExpression.
public final Expression addExpression() throws ParseException {
Expression left;
Expression right;
left = multExpr();
label_7: while (true) {
if (jj_2_5(2147483647)) {
;
} else {
break label_7;
}
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 36:
jj_consume_token(36);
right = multExpr();
left = ArithmeticExpression.createPlus(left, right);
break;
case 37:
jj_consume_token(37);
right = multExpr();
left = ArithmeticExpression.createMinus(left, right);
break;
default:
jj_consume_token(-1);
throw new ParseException();
}
}
{
if (true)
return left;
}
throw new Error("Missing return statement in function");
}
use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class SelectorParser method orExpression.
public final Expression orExpression() throws ParseException {
Expression left;
Expression right;
left = andExpression();
label_1: while (true) {
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case OR:
;
break;
default:
break label_1;
}
jj_consume_token(OR);
right = andExpression();
left = LogicExpression.createOR(asBooleanExpression(left), asBooleanExpression(right));
}
{
if (true)
return left;
}
throw new Error("Missing return statement in function");
}
Aggregations