01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 2004-2007 Robert Grimm
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * version 2 as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17: * USA.
18: */
19: package xtc.parser;
20:
21: /**
22: * Element to set the semantic value to the result of applying a list
23: * of {@link xtc.util.Action actions}. The actions are applied by
24: * invoking {@link ParserBase#apply(Pair,Object)} on the list and a
25: * seed value.
26: *
27: * @author Robert Grimm
28: * @version $Revision: 1.11 $
29: */
30: public class ActionBaseValue extends ValueElement {
31:
32: /** The binding for the list. */
33: public final Binding list;
34:
35: /** The binding for the seed. */
36: public final Binding seed;
37:
38: /**
39: * Create a new action base value.
40: *
41: * @param list The binding for the list.
42: * @param seed The binding for the seed.
43: */
44: public ActionBaseValue(Binding list, Binding seed) {
45: this .list = list;
46: this .seed = seed;
47: }
48:
49: public Tag tag() {
50: return Tag.ACTION_BASE_VALUE;
51: }
52:
53: public int hashCode() {
54: return 13 * list.hashCode() + seed.hashCode();
55: }
56:
57: public boolean equals(Object o) {
58: if (this == o)
59: return true;
60: if (!(o instanceof ActionBaseValue))
61: return false;
62: ActionBaseValue other = (ActionBaseValue) o;
63: if (!list.equals(other.list))
64: return false;
65: return seed.equals(other.seed);
66: }
67:
68: }
|