01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 2005-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: import java.util.List;
22:
23: /**
24: * Element to set the semantic value to an {@link xtc.util.Action
25: * action}. This element sets the semantic value to an action that
26: * produces a generic node. The generic node's children are a
27: * production's component expressions, with the action's argument
28: * being the first child.
29: *
30: * @author Robert Grimm
31: * @version $Revision: 1.9 $
32: */
33: public class GenericActionValue extends GenericValue {
34:
35: /**
36: * The name of the action's argument, which also becomes the generic
37: * node's first child.
38: */
39: public final String first;
40:
41: /**
42: * Create a new generic action value.
43: *
44: * @param name The name of the generic node.
45: * @param first The action's argument.
46: * @param children The list of children.
47: * @param formatting The list of bindings for formatting.
48: */
49: public GenericActionValue(String name, String first,
50: List<Binding> children, List<Binding> formatting) {
51: super (name, children, formatting);
52: this .first = first;
53: }
54:
55: public Tag tag() {
56: return Tag.GENERIC_ACTION_VALUE;
57: }
58:
59: public int hashCode() {
60: return name.hashCode();
61: }
62:
63: public boolean equals(Object o) {
64: if (this == o)
65: return true;
66: if (!(o instanceof GenericActionValue))
67: return false;
68: GenericActionValue other = (GenericActionValue) o;
69: if (!name.equals(other.name))
70: return false;
71: if (!first.equals(other.first))
72: return false;
73: if (!children.equals(other.children))
74: return false;
75: return formatting.equals(other.formatting);
76: }
77:
78: }
|