01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * $Header:$
18: */
19: package org.apache.beehive.netui.compiler.typesystem.declaration;
20:
21: public class Modifier {
22: protected static final int INT_ABSTRACT = 0;
23: protected static final int INT_PRIVATE = 1;
24: protected static final int INT_PROTECTED = 2;
25: protected static final int INT_PUBLIC = 3;
26: protected static final int INT_STATIC = 4;
27: protected static final int INT_TRANSIENT = 5;
28: protected static final int INT_FINAL = 6;
29: protected static final int INT_SYNCHRONIZED = 7;
30: protected static final int INT_NATIVE = 8;
31:
32: public static final Modifier ABSTRACT = new Modifier(INT_ABSTRACT);
33: public static final Modifier PRIVATE = new Modifier(INT_PRIVATE);
34: public static final Modifier PROTECTED = new Modifier(INT_PROTECTED);
35: public static final Modifier PUBLIC = new Modifier(INT_PUBLIC);
36: public static final Modifier STATIC = new Modifier(INT_STATIC);
37: public static final Modifier TRANSIENT = new Modifier(INT_TRANSIENT);
38: public static final Modifier FINAL = new Modifier(INT_FINAL);
39: public static final Modifier SYNCHRONIZED = new Modifier(
40: INT_SYNCHRONIZED);
41: public static final Modifier NATIVE = new Modifier(INT_NATIVE);
42:
43: private int _val;
44:
45: private Modifier(int val) {
46: _val = val;
47: }
48:
49: public String toString() {
50: switch (_val) {
51: case INT_ABSTRACT:
52: return "abstract";
53: case INT_PRIVATE:
54: return "private";
55: case INT_PROTECTED:
56: return "protected";
57: case INT_PUBLIC:
58: return "public";
59: case INT_STATIC:
60: return "static";
61: case INT_TRANSIENT:
62: return "transient";
63: case INT_FINAL:
64: return "final";
65: case INT_SYNCHRONIZED:
66: return "synchronized";
67: case INT_NATIVE:
68: return "native";
69: }
70:
71: assert false : _val;
72: return "<unknown Modifier>";
73: }
74:
75: public boolean equals(Object o) {
76: if (o == null)
77: return false;
78: if (o == this )
79: return true;
80: if (!(o instanceof Modifier))
81: return false;
82: return ((Modifier) o)._val == _val;
83: }
84:
85: public int hashCode() {
86: return _val;
87: }
88:
89: protected Modifier() {
90: _val = -1;
91: }
92:
93: protected void setVal(int val) {
94: _val = val;
95: }
96: }
|