KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > jmi > javamodel > OperatorEnum


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.jmi.javamodel;
21
22 /**
23  * Operator enumeration class implementation.
24  * Enumeration of Java operators.
25  *
26  * <p><em><strong>Note:</strong> This type should not be subclassed or implemented
27  * by clients. It is generated from a MOF metamodel and automatically implemented
28  * by MDR (see <a HREF="http://mdr.netbeans.org/">mdr.netbeans.org</a>).</em></p>
29  */

30 public final class OperatorEnum implements Operator {
31     /**
32      * Enumeration constant corresponding to literal assign.
33      */

34     public static final OperatorEnum ASSIGN = new OperatorEnum("assign");
35     /**
36      * Enumeration constant corresponding to literal gt.
37      */

38     public static final OperatorEnum GT = new OperatorEnum("gt");
39     /**
40      * Enumeration constant corresponding to literal lt.
41      */

42     public static final OperatorEnum LT = new OperatorEnum("lt");
43     /**
44      * Enumeration constant corresponding to literal not.
45      */

46     public static final OperatorEnum NOT = new OperatorEnum("not");
47     /**
48      * Enumeration constant corresponding to literal equal.
49      */

50     public static final OperatorEnum EQUAL = new OperatorEnum("equal");
51     /**
52      * Enumeration constant corresponding to literal lte.
53      */

54     public static final OperatorEnum LTE = new OperatorEnum("lte");
55     /**
56      * Enumeration constant corresponding to literal gte.
57      */

58     public static final OperatorEnum GTE = new OperatorEnum("gte");
59     /**
60      * Enumeration constant corresponding to literal nequal.
61      */

62     public static final OperatorEnum NEQUAL = new OperatorEnum("nequal");
63     /**
64      * Enumeration constant corresponding to literal land.
65      */

66     public static final OperatorEnum LAND = new OperatorEnum("land");
67     /**
68      * Enumeration constant corresponding to literal lor.
69      */

70     public static final OperatorEnum LOR = new OperatorEnum("lor");
71     /**
72      * Enumeration constant corresponding to literal inc.
73      */

74     public static final OperatorEnum INC = new OperatorEnum("inc");
75     /**
76      * Enumeration constant corresponding to literal dec.
77      */

78     public static final OperatorEnum DEC = new OperatorEnum("dec");
79     /**
80      * Enumeration constant corresponding to literal plus.
81      */

82     public static final OperatorEnum PLUS = new OperatorEnum("plus");
83     /**
84      * Enumeration constant corresponding to literal minus.
85      */

86     public static final OperatorEnum MINUS = new OperatorEnum("minus");
87     /**
88      * Enumeration constant corresponding to literal multi.
89      */

90     public static final OperatorEnum MULTI = new OperatorEnum("multi");
91     /**
92      * Enumeration constant corresponding to literal div.
93      */

94     public static final OperatorEnum DIV = new OperatorEnum("div");
95     /**
96      * Enumeration constant corresponding to literal and.
97      */

98     public static final OperatorEnum AND = new OperatorEnum("and");
99     /**
100      * Enumeration constant corresponding to literal or.
101      */

102     public static final OperatorEnum OR = new OperatorEnum("or");
103     /**
104      * Enumeration constant corresponding to literal xor.
105      */

106     public static final OperatorEnum XOR = new OperatorEnum("xor");
107     /**
108      * Enumeration constant corresponding to literal mod.
109      */

110     public static final OperatorEnum MOD = new OperatorEnum("mod");
111     /**
112      * Enumeration constant corresponding to literal lshift.
113      */

114     public static final OperatorEnum LSHIFT = new OperatorEnum("lshift");
115     /**
116      * Enumeration constant corresponding to literal rshift.
117      */

118     public static final OperatorEnum RSHIFT = new OperatorEnum("rshift");
119     /**
120      * Enumeration constant corresponding to literal urshift.
121      */

122     public static final OperatorEnum URSHIFT = new OperatorEnum("urshift");
123     /**
124      * Enumeration constant corresponding to literal plusassign.
125      */

126     public static final OperatorEnum PLUSASSIGN = new OperatorEnum("plusassign");
127     /**
128      * Enumeration constant corresponding to literal minusassign.
129      */

130     public static final OperatorEnum MINUSASSIGN = new OperatorEnum("minusassign");
131     /**
132      * Enumeration constant corresponding to literal multiassign.
133      */

134     public static final OperatorEnum MULTIASSIGN = new OperatorEnum("multiassign");
135     /**
136      * Enumeration constant corresponding to literal divassign.
137      */

138     public static final OperatorEnum DIVASSIGN = new OperatorEnum("divassign");
139     /**
140      * Enumeration constant corresponding to literal andassign.
141      */

142     public static final OperatorEnum ANDASSIGN = new OperatorEnum("andassign");
143     /**
144      * Enumeration constant corresponding to literal orassign.
145      */

146     public static final OperatorEnum ORASSIGN = new OperatorEnum("orassign");
147     /**
148      * Enumeration constant corresponding to literal xorassign.
149      */

150     public static final OperatorEnum XORASSIGN = new OperatorEnum("xorassign");
151     /**
152      * Enumeration constant corresponding to literal modassign.
153      */

154     public static final OperatorEnum MODASSIGN = new OperatorEnum("modassign");
155     /**
156      * Enumeration constant corresponding to literal lshiftassign.
157      */

158     public static final OperatorEnum LSHIFTASSIGN = new OperatorEnum("lshiftassign");
159     /**
160      * Enumeration constant corresponding to literal rshiftassign.
161      */

162     public static final OperatorEnum RSHIFTASSIGN = new OperatorEnum("rshiftassign");
163     /**
164      * Enumeration constant corresponding to literal urshiftassign.
165      */

166     public static final OperatorEnum URSHIFTASSIGN = new OperatorEnum("urshiftassign");
167     /**
168      * Enumeration constant corresponding to literal comp.
169      */

170     public static final OperatorEnum COMP = new OperatorEnum("comp");
171     /**
172      * Enumeration constant corresponding to literal instanceof.
173      */

174     public static final OperatorEnum INSTANCEOF = new OperatorEnum("instanceof");
175
176     private static final java.util.List JavaDoc typeName;
177     private final java.lang.String JavaDoc literalName;
178
179     static {
180         java.util.ArrayList JavaDoc temp = new java.util.ArrayList JavaDoc();
181         temp.add("JavaModel");
182         temp.add("Operator");
183         typeName = java.util.Collections.unmodifiableList(temp);
184     }
185
186     private OperatorEnum(java.lang.String JavaDoc literalName) {
187         this.literalName = literalName;
188     }
189
190     /**
191      * Returns fully qualified name of the enumeration type.
192      * @return List containing all parts of the fully qualified name.
193      */

194     public java.util.List JavaDoc refTypeName() {
195         return typeName;
196     }
197
198     /**
199      * Returns a string representation of the enumeration value.
200      * @return A string representation of the enumeration value.
201      */

202     public java.lang.String JavaDoc toString() {
203         return literalName;
204     }
205
206     /**
207      * Returns a hash code for this the enumeration value.
208      * @return A hash code for this enumeration value.
209      */

210     public int hashCode() {
211         return literalName.hashCode();
212     }
213
214     /**
215      * Indicates whether some other object is equal to this enumeration value.
216      * @param o The reference object with which to compare.
217      * @return true if the other object is the enumeration of the same type and
218      * of the same value.
219      */

220     public boolean equals(java.lang.Object JavaDoc o) {
221         if (o instanceof OperatorEnum) return (o == this);
222         else if (o instanceof Operator) return (o.toString().equals(literalName));
223         else return ((o instanceof javax.jmi.reflect.RefEnum) && ((javax.jmi.reflect.RefEnum) o).refTypeName().equals(typeName) && o.toString().equals(literalName));
224     }
225
226     /**
227      * Translates literal name to correspondent enumeration value.
228      * @param name Enumeration literal.
229      * @return Enumeration value corresponding to the passed literal.
230      */

231     public static Operator forName(java.lang.String JavaDoc name) {
232         if (name.equals("assign")) return ASSIGN;
233         if (name.equals("gt")) return GT;
234         if (name.equals("lt")) return LT;
235         if (name.equals("not")) return NOT;
236         if (name.equals("equal")) return EQUAL;
237         if (name.equals("lte")) return LTE;
238         if (name.equals("gte")) return GTE;
239         if (name.equals("nequal")) return NEQUAL;
240         if (name.equals("land")) return LAND;
241         if (name.equals("lor")) return LOR;
242         if (name.equals("inc")) return INC;
243         if (name.equals("dec")) return DEC;
244         if (name.equals("plus")) return PLUS;
245         if (name.equals("minus")) return MINUS;
246         if (name.equals("multi")) return MULTI;
247         if (name.equals("div")) return DIV;
248         if (name.equals("and")) return AND;
249         if (name.equals("or")) return OR;
250         if (name.equals("xor")) return XOR;
251         if (name.equals("mod")) return MOD;
252         if (name.equals("lshift")) return LSHIFT;
253         if (name.equals("rshift")) return RSHIFT;
254         if (name.equals("urshift")) return URSHIFT;
255         if (name.equals("plusassign")) return PLUSASSIGN;
256         if (name.equals("minusassign")) return MINUSASSIGN;
257         if (name.equals("multiassign")) return MULTIASSIGN;
258         if (name.equals("divassign")) return DIVASSIGN;
259         if (name.equals("andassign")) return ANDASSIGN;
260         if (name.equals("orassign")) return ORASSIGN;
261         if (name.equals("xorassign")) return XORASSIGN;
262         if (name.equals("modassign")) return MODASSIGN;
263         if (name.equals("lshiftassign")) return LSHIFTASSIGN;
264         if (name.equals("rshiftassign")) return RSHIFTASSIGN;
265         if (name.equals("urshiftassign")) return URSHIFTASSIGN;
266         if (name.equals("comp")) return COMP;
267         if (name.equals("instanceof")) return INSTANCEOF;
268         throw new java.lang.IllegalArgumentException JavaDoc("Unknown literal name '" + name + "' for enumeration 'JavaModel.Operator'");
269     }
270     /**
271      * Resolves serialized instance of enumeration value.
272      * @return Resolved enumeration value.
273      */

274     protected java.lang.Object JavaDoc readResolve() throws java.io.ObjectStreamException JavaDoc {
275         try {
276             return forName(literalName);
277         } catch (java.lang.IllegalArgumentException JavaDoc e) {
278             throw new java.io.InvalidObjectException JavaDoc(e.getMessage());
279         }
280     }
281 }
282
Popular Tags