KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gcc > generator > JEntity


1 /*
2  * Copyright 2004 The Apache Software Foundation or its licensors, as
3  * applicable.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * 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
14  * implied.
15  *
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19 package gcc.generator;
20
21 public class JEntity
22 {
23     protected String _name;
24     protected int _modifiers;
25     protected JEntity _parent;
26
27     public JEntity( String name )
28     {
29         this( name, 0 );
30     }
31
32     public JEntity( String name, int modifiers )
33     {
34         _name = name;
35         _modifiers = modifiers;
36     }
37
38     public JEntity getParent()
39     {
40         return _parent;
41     }
42
43     public void setParent( JEntity parent )
44     {
45         _parent = parent;
46     }
47
48     public String getName()
49     {
50         return _name;
51     }
52
53     public void setName( String val )
54     {
55         _name = val;
56     }
57
58     /*
59      * if value is true, then the modifier will be set,
60      * if value is false, then the modifier will be unset.
61      */

62     public void setModifier( int modifier, boolean value )
63     {
64         if (value)
65         {
66             _modifiers = (_modifiers | modifier);
67         }
68         else
69         {
70             if ( (_modifiers & modifier) == modifier )
71             {
72                 _modifiers = ( _modifiers ^ modifier);
73             }
74         }
75     }
76
77     public void setModifiers( int modifiers )
78     {
79         _modifiers = modifiers;
80     }
81
82     public int getModifiers()
83     {
84         return _modifiers;
85     }
86 }
87
Popular Tags