Committing more fixes for bug #1839622 RSE Path error. This will clean up php files...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / obfuscator / PHPIdentifier.java
1 package net.sourceforge.phpeclipse.obfuscator;
2
3 /**
4  * Object which holds an PHP identifier name (i.e. class, function,
5  * variable,...)
6  * 
7  */
8 public class PHPIdentifier {
9
10         public final static int CLASS = 1;
11
12         public final static int FUNCTION = 2;
13
14         public final static int VARIABLE = 3;
15
16         public final static int METHOD = 4;
17
18         public final static int DEFINE = 5;
19
20         public final static int CONSTRUCTOR = 6;
21
22         public final static int GLOBAL_VARIABLE = 7;
23
24         public final static int EXTENDS = 8;
25
26         public final static int IMPLEMENTS = 9;
27
28         private String fIdentifier;
29
30         private int fType;
31
32         public PHPIdentifier(String identifier, int type) {
33                 fType = type;
34                 fIdentifier = identifier;
35         }
36
37         /*
38          * (non-Javadoc)
39          * 
40          * @see java.lang.Object#equals(java.lang.Object)
41          */
42         public boolean equals(Object obj) {
43                 if (!(obj instanceof PHPIdentifier)) {
44                         return false;
45                 }
46                 return ((PHPIdentifier) obj).fType == fType
47                                 && ((PHPIdentifier) obj).fIdentifier.equals(fIdentifier);
48         }
49
50         public String getIdentifier() {
51                 return fIdentifier;
52         }
53
54         public int getType() {
55                 return fType;
56         }
57
58         public boolean isClass() {
59                 return fType == CLASS;
60         }
61
62         public boolean isFunction() {
63                 return fType == FUNCTION;
64         }
65
66         public boolean isVariable() {
67                 return fType == VARIABLE;
68         }
69
70         public boolean isMethod() {
71                 return fType == METHOD;
72         }
73
74         public boolean isDefine() {
75                 return fType == DEFINE;
76         }
77
78         public boolean isGlobalVariable() {
79                 return fType == GLOBAL_VARIABLE;
80         }
81
82         public boolean isConstructor() {
83                 return fType == CONSTRUCTOR;
84         }
85
86         public void setIdentifier(String fIdentifier) {
87                 this.fIdentifier = fIdentifier;
88         }
89
90         public void setType(int fType) {
91                 this.fType = fType;
92         }
93
94         /*
95          * (non-Javadoc)
96          * 
97          * @see java.lang.Object#toString()
98          */
99         public String toString() {
100                 switch (fType) {
101                 case CLASS:
102                         return "class - ";
103                 case CONSTRUCTOR:
104                         return "constructor - ";
105                 case DEFINE:
106                         return "define - ";
107                 case FUNCTION:
108                         return "function - ";
109                 case GLOBAL_VARIABLE:
110                         return "global variable - ";
111                 case METHOD:
112                         return "method - ";
113                 case VARIABLE:
114                         return "variable - ";
115                 }
116                 return "";
117         }
118
119 }