1 /***
2 * Copyright 2003, 2004, 2005. CodeStreet LLC.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14
15 package com.codestreet.selector.parser;
16
17 import java.util.Map;
18
19 /***
20 * Class to implement arithmetic operators.
21 *
22 * @author Jawaid Hakim.
23 */
24 class ArithOp implements IExpression
25 {
26 /***
27 * Ctor.
28 *
29 * @param op
30 * Arithmetic operator.
31 * @param lhs
32 * LHS.
33 * @param rhs
34 * RHS.
35 */
36 public ArithOp(final ArithOpImpl op, final IExpression lhs,
37 final IExpression rhs)
38 {
39 op_ = op;
40 lhs_ = lhs;
41 rhs_ = rhs;
42 }
43
44 public Object eval(final Map identifiers)
45 {
46 return op_.eval(identifiers, lhs_, rhs_);
47 }
48
49 public Object eval(final IValueProvider provider, final Object corr)
50 {
51 return op_.eval(provider, corr, lhs_, rhs_);
52 }
53
54 public String toString()
55 {
56 return lhs_.toString() + op_.toString() + rhs_.toString();
57 }
58
59 private final IExpression lhs_;
60
61 private final IExpression rhs_;
62
63 private final ArithOpImpl op_;
64 }
This page was automatically generated by Maven