1 21 package proguard.evaluation.value; 22 23 28 class SpecificLongValue extends LongValue 29 { 30 private long value; 31 32 33 36 public SpecificLongValue(long value) 37 { 38 this.value = value; 39 } 40 41 42 44 public long value() 45 { 46 return value; 47 } 48 49 50 52 55 public LongValue generalize(LongValue other) 56 { 57 return other.generalize(this); 58 } 59 60 public LongValue add(LongValue other) 61 { 62 return other.add(this); 63 } 64 65 public LongValue subtract(LongValue other) 66 { 67 return other.subtractFrom(this); 68 } 69 70 public LongValue subtractFrom(LongValue other) 71 { 72 return other.subtract(this); 73 } 74 75 public LongValue multiply(LongValue other) 76 { 77 return other.multiply(this); 78 } 79 80 public LongValue divide(LongValue other) 81 { 82 return other.divideOf(this); 83 } 84 85 public LongValue divideOf(LongValue other) 86 { 87 return other.divide(this); 88 } 89 90 public LongValue remainder(LongValue other) 91 { 92 return other.remainderOf(this); 93 } 94 95 public LongValue remainderOf(LongValue other) 96 { 97 return other.remainder(this); 98 } 99 100 public LongValue shiftLeft(IntegerValue other) 101 { 102 return other.shiftLeftOf(this); 103 } 104 105 public LongValue shiftRight(IntegerValue other) 106 { 107 return other.shiftRightOf(this); 108 } 109 110 public LongValue unsignedShiftRight(IntegerValue other) 111 { 112 return other.unsignedShiftRightOf(this); 113 } 114 115 public LongValue and(LongValue other) 116 { 117 return other.and(this); 118 } 119 120 public LongValue or(LongValue other) 121 { 122 return other.or(this); 123 } 124 125 public LongValue xor(LongValue other) 126 { 127 return other.xor(this); 128 } 129 130 public IntegerValue compare(LongValue other, ValueFactory valueFactory) 131 { 132 return other.compareReverse(this, valueFactory); 133 } 134 135 136 138 public LongValue negate() 139 { 140 return new SpecificLongValue(-value); 141 } 142 143 public IntegerValue convertToInteger(ValueFactory valueFactory) 144 { 145 return valueFactory.createIntegerValue((int)value); 146 } 147 148 public FloatValue convertToFloat(ValueFactory valueFactory) 149 { 150 return valueFactory.createFloatValue((float)value); 151 } 152 153 public DoubleValue convertToDouble(ValueFactory valueFactory) 154 { 155 return valueFactory.createDoubleValue((double)value); 156 } 157 158 159 162 public LongValue generalize(SpecificLongValue other) 163 { 164 return this.value == other.value ? this : ValueFactory.LONG_VALUE; 165 } 166 167 public LongValue add(SpecificLongValue other) 168 { 169 return new SpecificLongValue(this.value + other.value); 170 } 171 172 public LongValue subtract(SpecificLongValue other) 173 { 174 return new SpecificLongValue(this.value - other.value); 175 } 176 177 public LongValue subtractFrom(SpecificLongValue other) 178 { 179 return new SpecificLongValue(other.value - this.value); 180 } 181 182 public LongValue multiply(SpecificLongValue other) 183 { 184 return new SpecificLongValue(this.value * other.value); 185 } 186 187 public LongValue divide(SpecificLongValue other) 188 { 189 return new SpecificLongValue(this.value / other.value); 190 } 191 192 public LongValue divideOf(SpecificLongValue other) 193 { 194 return new SpecificLongValue(other.value / this.value); 195 } 196 197 public LongValue remainder(SpecificLongValue other) 198 { 199 return new SpecificLongValue(this.value % other.value); 200 } 201 202 public LongValue remainderOf(SpecificLongValue other) 203 { 204 return new SpecificLongValue(other.value % this.value); 205 } 206 207 public LongValue shiftLeft(SpecificIntegerValue other) 208 { 209 return new SpecificLongValue(this.value << other.value()); 210 } 211 212 public LongValue shiftRight(SpecificIntegerValue other) 213 { 214 return new SpecificLongValue(this.value >> other.value()); 215 } 216 217 public LongValue unsignedShiftRight(SpecificIntegerValue other) 218 { 219 return new SpecificLongValue(this.value >>> other.value()); 220 } 221 222 public LongValue and(SpecificLongValue other) 223 { 224 return new SpecificLongValue(this.value & other.value); 225 } 226 227 public LongValue or(SpecificLongValue other) 228 { 229 return new SpecificLongValue(this.value | other.value); 230 } 231 232 public LongValue xor(SpecificLongValue other) 233 { 234 return new SpecificLongValue(this.value ^ other.value); 235 } 236 237 public IntegerValue compare(SpecificLongValue other, ValueFactory valueFactory) 238 { 239 return this.value < other.value ? valueFactory.createIntegerValue(-1) : 240 this.value == other.value ? valueFactory.createIntegerValue(0) : 241 valueFactory.createIntegerValue(1); 242 } 243 244 245 247 public boolean isSpecific() 248 { 249 return true; 250 } 251 252 253 255 public boolean equals(Object object) 256 { 257 return object != null && 258 this.getClass() == object.getClass() && 259 this.value == ((SpecificLongValue)object).value; 260 } 261 262 263 public int hashCode() 264 { 265 return this.getClass().hashCode() ^ (int)value; 266 } 267 268 269 public String toString() 270 { 271 return "l:"+value; 272 } 273 } 274 | Popular Tags |