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 /*package*/ class CompareExpression implements Expression {
12 public static enum OP { RE, EQ, NE, GT, GE, LT, LE };
14 private final OP _operation;
15 private final String _selector;
16 private final String _arg;
18 public CompareExpression(OP op, String selector, String arg) {
25 public OP getOperator() {
29 public String getSelector() {
33 public String getArgument() {
38 public boolean accept(Visitor visitor) throws QueryException {
39 return visitor.visit(this);
43 public String toString() {
44 return "[" + _selector + " " + _operation + " " + _arg + "]";
47 private static String unQuote(String s) {
48 if (s.startsWith("\"") && s.endsWith("\"")) {
49 s = s.substring(1, s.length()-1);
50 } else if (s.startsWith("\'") && s.endsWith("\'")) {
51 s = s.substring(1, s.length()-1);