1 30 package org.objectweb.asm; 31 32 38 final class Item { 39 40 43 short index; 44 45 53 char type; 54 55 58 int intVal; 59 60 63 long longVal; 64 65 68 float floatVal; 69 70 73 double doubleVal; 74 75 79 String strVal1; 80 81 85 String strVal2; 86 87 91 String strVal3; 92 93 96 int hashCode; 97 98 102 Item next; 103 104 107 Item() { 108 } 109 110 116 Item(final short index, final Item i) { 117 this.index = index; 118 type = i.type; 119 intVal = i.intVal; 120 longVal = i.longVal; 121 floatVal = i.floatVal; 122 doubleVal = i.doubleVal; 123 strVal1 = i.strVal1; 124 strVal2 = i.strVal2; 125 strVal3 = i.strVal3; 126 hashCode = i.hashCode; 127 } 128 129 134 void set(final int intVal) { 135 this.type = 'I'; 136 this.intVal = intVal; 137 this.hashCode = 0x7FFFFFFF & (type + intVal); 138 } 139 140 145 void set(final long longVal) { 146 this.type = 'J'; 147 this.longVal = longVal; 148 this.hashCode = 0x7FFFFFFF & (type + (int) longVal); 149 } 150 151 156 void set(final float floatVal) { 157 this.type = 'F'; 158 this.floatVal = floatVal; 159 this.hashCode = 0x7FFFFFFF & (type + (int) floatVal); 160 } 161 162 167 void set(final double doubleVal) { 168 this.type = 'D'; 169 this.doubleVal = doubleVal; 170 this.hashCode = 0x7FFFFFFF & (type + (int) doubleVal); 171 } 172 173 181 void set( 182 final char type, 183 final String strVal1, 184 final String strVal2, 185 final String strVal3) 186 { 187 this.type = type; 188 this.strVal1 = strVal1; 189 this.strVal2 = strVal2; 190 this.strVal3 = strVal3; 191 switch (type) { 192 case 's': 193 case 'S': 194 case 'C': 195 hashCode = 0x7FFFFFFF & (type + strVal1.hashCode()); 196 return; 197 case 'T': 198 hashCode = 0x7FFFFFFF & (type + strVal1.hashCode() 199 * strVal2.hashCode()); 200 return; 201 default: 205 hashCode = 0x7FFFFFFF & (type + strVal1.hashCode() 206 * strVal2.hashCode() * strVal3.hashCode()); 207 } 208 } 209 210 217 boolean isEqualTo(final Item i) { 218 if (i.type == type) { 219 switch (type) { 220 case 'I': 221 return i.intVal == intVal; 222 case 'J': 223 return i.longVal == longVal; 224 case 'F': 225 return i.floatVal == floatVal; 226 case 'D': 227 return i.doubleVal == doubleVal; 228 case 's': 229 case 'S': 230 case 'C': 231 return i.strVal1.equals(strVal1); 232 case 'T': 233 return i.strVal1.equals(strVal1) 234 && i.strVal2.equals(strVal2); 235 default: 239 return i.strVal1.equals(strVal1) 240 && i.strVal2.equals(strVal2) 241 && i.strVal3.equals(strVal3); 242 } 243 } 244 return false; 245 } 246 } 247 | Popular Tags |