KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openlaszlo > sc > parser > ASTIdentifier


1 /* ****************************************************************************
2  * ASTIdentifier.java
3 * ****************************************************************************/

4
5 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
6 * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
7 * Use is subject to license terms. *
8 * J_LZ_COPYRIGHT_END *********************************************************/

9
10 package org.openlaszlo.sc.parser;
11
12 public class ASTIdentifier extends SimpleNode {
13     private String JavaDoc name = null;
14     private int hash = 0;
15   
16     public ASTIdentifier(int id) {
17         super(id);
18     }
19
20     public ASTIdentifier(Parser p, int id) {
21         super(p, id);
22     }
23
24     public static Node jjtCreate(int id) {
25         return new ASTIdentifier(id);
26     }
27
28     public static Node jjtCreate(Parser p, int id) {
29         return new ASTIdentifier(p, id);
30     }
31
32     // Added
33
public ASTIdentifier(String JavaDoc s) {
34         setName(s);
35     }
36
37     public void setName(String JavaDoc name) {
38         this.name = name.intern(); // to lower number of strings
39
this.hash = name.hashCode();
40     }
41   
42     public int hashCode() {
43         return hash;
44     }
45   
46     public String JavaDoc getName() {
47         return name;
48     }
49   
50     public String JavaDoc toString() {
51         return "ASTIdentifier(" + name + ")";
52     }
53 }
54
Popular Tags