01: /*
02: * Author: Mike Atkinson
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package net.sourceforge.jrefactory.ast;
10:
11: import net.sourceforge.jrefactory.parser.JavaParser;
12:
13: /**
14: * Declares node with a name.
15: *
16: * @author Mike Atkinson
17: * @since jRefactory 2.9.0, created October 16, 2003
18: */
19: public abstract class NamedNode extends SimpleNode {
20: protected String name = "";
21:
22: /**
23: * Constructor for the Named node.
24: *
25: * @param identifier The id of this node.
26: */
27: protected NamedNode(int identifier) {
28: super (identifier);
29: }
30:
31: /**
32: * Constructor for the Named node.
33: *
34: * @param parser The JavaParser that created this Named node.
35: * @param identifier The id of this node.
36: */
37: protected NamedNode(JavaParser parser, int identifier) {
38: super (parser, identifier);
39: }
40:
41: /**
42: * Set the object's name
43: *
44: * @param newName the new name
45: */
46: public void setName(String newName) {
47: name = newName.intern();
48: }
49:
50: /**
51: * Get the object's name
52: *
53: * @return the name
54: */
55: public String getName() {
56: return name;
57: }
58:
59: }
|