1 34 35 package net.percederberg.grammatica.code.visualbasic; 36 37 47 abstract class VisualBasicModifier { 48 49 52 public static final int PUBLIC = 1; 53 54 57 public static final int PROTECTED_FRIEND = 2; 58 59 62 public static final int PROTECTED = 3; 63 64 67 public static final int FRIEND = 4; 68 69 72 public static final int PRIVATE = 5; 73 74 77 public static final int MUST_INHERIT = 8; 78 79 82 public static final int NOT_INHERITABLE = 16; 83 84 87 public static final int SHARED = 32; 88 89 92 public static final int SHADOWS = 64; 93 94 97 public static final int OVERRIDABLE = 128; 98 99 102 public static final int NOT_OVERRIDABLE = 256; 103 104 107 public static final int OVERRIDES = 512; 108 109 112 public static final int MUST_OVERRIDE = 1024; 113 114 117 public static final int OVERLOADS = 2048; 118 119 126 public static String createModifierDecl(int modifiers) { 127 StringBuffer res = new StringBuffer (); 128 129 switch (modifiers % 8) { 131 case PUBLIC: 132 res.append("Public "); 133 break; 134 case PROTECTED_FRIEND: 135 res.append("Protected Friend "); 136 break; 137 case PROTECTED: 138 res.append("Protected "); 139 break; 140 case FRIEND: 141 res.append("Friend "); 142 break; 143 case PRIVATE: 144 res.append("Private "); 145 break; 146 } 147 148 if ((modifiers & MUST_INHERIT) > 0) { 150 res.append("MustInherit "); 151 } 152 if ((modifiers & NOT_INHERITABLE) > 0) { 153 res.append("NotInheritable "); 154 } 155 if ((modifiers & SHARED) > 0) { 156 res.append("Shared "); 157 } 158 if ((modifiers & SHADOWS) > 0) { 159 res.append("Shadows "); 160 } 161 if ((modifiers & OVERRIDABLE) > 0) { 162 res.append("Overridable "); 163 } 164 if ((modifiers & NOT_OVERRIDABLE) > 0) { 165 res.append("NotOverridable "); 166 } 167 if ((modifiers & OVERRIDES) > 0) { 168 res.append("Overrides "); 169 } 170 if ((modifiers & MUST_OVERRIDE) > 0) { 171 res.append("MustOverride "); 172 } 173 if ((modifiers & OVERLOADS) > 0) { 174 res.append("Overloads "); 175 } 176 177 return res.toString(); 178 } 179 } 180 | Popular Tags |