2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.northbound.commons.query;
10 import java.util.Stack;
12 /*package*/ class ExpressionBuilder {
13 private final Stack<Expression> _stack = new Stack<Expression>();
14 private LogicalExpression.OP _lastOp = null;
16 public ExpressionBuilder() {}
18 public ExpressionBuilder withAnd() {
19 _lastOp = LogicalExpression.OP.AND;
23 public ExpressionBuilder withOr() {
24 _lastOp = LogicalExpression.OP.OR;
28 public ExpressionBuilder withTerm(Expression exp) {
29 if (_lastOp != null) {
30 exp = new LogicalExpression(_lastOp, _stack.pop(), exp);
37 public Expression build() {