BUG-2218: Keep existing link augmentations during discovery process
[controller.git] / opendaylight / adsal / northbound / commons / src / main / java / org / opendaylight / controller / northbound / commons / query / LogicalExpression.java
1 /**
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.northbound.commons.query;
9
10 /*package*/ class LogicalExpression implements Expression {
11
12     public static enum OP { AND, OR }
13
14     private final OP _op;
15     private final Expression _arg1;
16     private final Expression _arg2;
17
18     public LogicalExpression(OP op, Expression first, Expression second) {
19         _op = op;
20         _arg1 = first;
21         _arg2 = second;
22     }
23
24     public OP getOperator() {
25         return _op;
26     }
27
28     public Expression getFirst() {
29         return _arg1;
30     }
31
32     public Expression getSecond() {
33         return _arg2;
34     }
35
36     @Override
37     public boolean accept(Visitor visitor) throws QueryException {
38         return visitor.visit(this);
39     }
40
41     @Override
42     public String toString() {
43         StringBuilder sb = new StringBuilder();
44         sb.append(_arg1.toString())
45         .append(_op.toString())
46         .append(_arg2.toString());
47         return sb.toString();
48     }
49
50 }