PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/bundles/plugins-trunk/XML/sidekick/ecmascript/parser/ASTIdentifier.java

#
Java | 62 lines | 43 code | 15 blank | 4 comment | 3 complexity | 563a0bd635bd9fc4264735a4114e113f MD5 | raw file
 1/* Generated By:JJTree: Do not edit this line. ASTIdentifier.java */
 2
 3package sidekick.ecmascript.parser;
 4
 5import sidekick.ecmascript.parser.EcmaScript;
 6import sidekick.ecmascript.parser.EcmaScriptVisitor;
 7import sidekick.ecmascript.parser.Token;
 8
 9public class ASTIdentifier extends SimpleNode {
10
11    private String identifierName = null;
12
13    private int hash = 0;
14
15    public ASTIdentifier(int id) {
16        super(id);
17    }
18
19    public ASTIdentifier(EcmaScript p, int id) {
20        super(p, id);
21    }
22
23    /** Accept the visitor. * */
24    @Override
25    public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
26        return visitor.visit(this, data);
27    }
28
29    public void setName(String identifierName) {
30        this.identifierName = identifierName.intern(); // to lower number of
31                                                        // strings
32        hash = identifierName.hashCode();
33        Token token = getBeginToken();
34        token.image = identifierName;
35    }
36
37    @Override
38    public int hashCode() {
39        return hash;
40    }
41
42    @Override
43    public boolean equals(Object obj) {
44        if ((obj != null) && (obj.getClass().equals(this.getClass()))) {
45            ASTIdentifier other = (ASTIdentifier) obj;
46            return identifierName.equals(other.identifierName);
47        }
48
49        return false;
50    }
51
52    public String getName() {
53        return identifierName;
54    }
55
56    @Override
57    public String toString() {
58        //return "Identifier[" + identifierName + "]";
59        return identifierName;
60    }
61
62}