01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 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.io.IOException;
22:
23: /**
24: * Element to set a generic node's name.
25: *
26: * @author Robert Grimm
27: * @version $Revision: 1.4 $
28: */
29: public class NodeMarker extends Element {
30:
31: /** The name. */
32: public final String name;
33:
34: /**
35: * Create a new node marker with the specified name.
36: *
37: * @param name The name.
38: */
39: public NodeMarker(String name) {
40: this .name = name;
41: }
42:
43: public Tag tag() {
44: return Tag.NODE_MARKER;
45: }
46:
47: public int hashCode() {
48: return name.hashCode();
49: }
50:
51: public boolean equals(Object o) {
52: if (this == o)
53: return true;
54: if (!(o instanceof NodeMarker))
55: return false;
56: return name.equals(((NodeMarker) o).name);
57: }
58:
59: public void write(Appendable out) throws IOException {
60: out.append('@');
61: out.append(name);
62: }
63:
64: }
|