01: /*
02: * Copyright (C) 2007 Júlio Vilmar Gesser.
03: *
04: * This file is part of Java 1.5 parser and Abstract Syntax Tree.
05: *
06: * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License as published by
08: * the Free Software Foundation, either version 3 of the License, or
09: * (at your option) any later version.
10: *
11: * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public License
17: * along with Java 1.5 parser and Abstract Syntax Tree. If not, see <http://www.gnu.org/licenses/>.
18: */
19: /*
20: * Created on 05/10/2006
21: */
22: package japa.parser.ast.expr;
23:
24: import japa.parser.ast.visitor.GenericVisitor;
25: import japa.parser.ast.visitor.VoidVisitor;
26:
27: /**
28: * @author Julio Vilmar Gesser
29: */
30: public final class BinaryExpr extends Expression {
31:
32: public static enum Operator {
33: or, // ||
34: and, // &&
35: binOr, // |
36: binAnd, // &
37: xor, // ^
38: equals, // ==
39: notEquals, // !=
40: less, // <
41: greater, // >
42: lessEquals, // <=
43: greaterEquals, // >=
44: lShift, // <<
45: rSignedShift, // >>
46: rUnsignedShift, // >>>
47: plus, // +
48: minus, // -
49: times, // *
50: divide, // /
51: remainder, // %
52: }
53:
54: public final Expression left;
55:
56: public final Expression right;
57:
58: public final Operator op;
59:
60: public BinaryExpr(int line, int column, Expression left,
61: Expression right, Operator op) {
62: super (line, column);
63: this .left = left;
64: this .right = right;
65: this .op = op;
66: }
67:
68: @Override
69: public <A> void accept(VoidVisitor<A> v, A arg) {
70: v.visit(this , arg);
71: }
72:
73: @Override
74: public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
75: return v.visit(this, arg);
76: }
77:
78: }
|