1 18 package org.apache.beehive.netui.compiler.typesystem.declaration; 19 20 public class Modifier 21 { 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( INT_SYNCHRONIZED ); 40 public static final Modifier NATIVE = new Modifier( INT_NATIVE ); 41 42 private int _val; 43 44 private Modifier( int val ) 45 { 46 _val = val; 47 } 48 49 public String toString() 50 { 51 switch ( _val ) 52 { 53 case INT_ABSTRACT: return "abstract"; 54 case INT_PRIVATE: return "private"; 55 case INT_PROTECTED: return "protected"; 56 case INT_PUBLIC: return "public"; 57 case INT_STATIC: return "static"; 58 case INT_TRANSIENT: return "transient"; 59 case INT_FINAL: return "final"; 60 case INT_SYNCHRONIZED: return "synchronized"; 61 case INT_NATIVE: return "native"; 62 } 63 64 assert false : _val; 65 return "<unknown Modifier>"; 66 } 67 68 public boolean equals( Object o ) 69 { 70 if ( o == null ) return false; 71 if ( o == this ) return true; 72 if ( ! ( o instanceof Modifier ) ) return false; 73 return ( ( Modifier ) o )._val == _val; 74 } 75 76 public int hashCode() 77 { 78 return _val; 79 } 80 81 protected Modifier() 82 { 83 _val = -1; 84 } 85 86 protected void setVal( int val ) 87 { 88 _val = val; 89 } 90 } 91 | Popular Tags |