1 21 package proguard.evaluation.value; 22 23 28 class SpecificFloatValue extends FloatValue 29 { 30 private float value; 31 32 33 36 public SpecificFloatValue(float value) 37 { 38 this.value = value; 39 } 40 41 42 44 public float value() 45 { 46 return value; 47 } 48 49 50 52 55 public FloatValue generalize(FloatValue other) 56 { 57 return other.generalize(this); 58 } 59 60 public FloatValue add(FloatValue other) 61 { 62 return other.add(this); 63 } 64 65 public FloatValue subtract(FloatValue other) 66 { 67 return other.subtractFrom(this); 68 } 69 70 public FloatValue subtractFrom(FloatValue other) 71 { 72 return other.subtract(this); 73 } 74 75 public FloatValue multiply(FloatValue other) 76 { 77 return other.multiply(this); 78 } 79 80 public FloatValue divide(FloatValue other) 81 { 82 return other.divideOf(this); 83 } 84 85 public FloatValue divideOf(FloatValue other) 86 { 87 return other.divide(this); 88 } 89 90 public FloatValue remainder(FloatValue other) 91 { 92 return other.remainderOf(this); 93 } 94 95 public FloatValue remainderOf(FloatValue other) 96 { 97 return other.remainder(this); 98 } 99 100 public IntegerValue compare(FloatValue other, ValueFactory valueFactory) 101 { 102 return other.compareReverse(this, valueFactory); 103 } 104 105 106 108 public FloatValue negate() 109 { 110 return new SpecificFloatValue(-value); 111 } 112 113 public IntegerValue convertToInteger(ValueFactory valueFactory) 114 { 115 return valueFactory.createIntegerValue((int)value); 116 } 117 118 public LongValue convertToLong(ValueFactory valueFactory) 119 { 120 return valueFactory.createLongValue((long)value); 121 } 122 123 public DoubleValue convertToDouble(ValueFactory valueFactory) 124 { 125 return valueFactory.createDoubleValue((double)value); 126 } 127 128 129 132 public FloatValue generalize(SpecificFloatValue other) 133 { 134 return this.value == other.value ? this : ValueFactory.FLOAT_VALUE; 135 } 136 137 public FloatValue add(SpecificFloatValue other) 138 { 139 return new SpecificFloatValue(this.value + other.value); 140 } 141 142 public FloatValue subtract(SpecificFloatValue other) 143 { 144 return new SpecificFloatValue(this.value - other.value); 145 } 146 147 public FloatValue subtractFrom(SpecificFloatValue other) 148 { 149 return new SpecificFloatValue(other.value - this.value); 150 } 151 152 public FloatValue multiply(SpecificFloatValue other) 153 { 154 return new SpecificFloatValue(this.value * other.value); 155 } 156 157 public FloatValue divide(SpecificFloatValue other) 158 { 159 return new SpecificFloatValue(this.value / other.value); 160 } 161 162 public FloatValue divideOf(SpecificFloatValue other) 163 { 164 return new SpecificFloatValue(other.value / this.value); 165 } 166 167 public FloatValue remainder(SpecificFloatValue other) 168 { 169 return new SpecificFloatValue(this.value % other.value); 170 } 171 172 public FloatValue remainderOf(SpecificFloatValue other) 173 { 174 return new SpecificFloatValue(other.value % this.value); 175 } 176 177 public IntegerValue compare(SpecificFloatValue other, ValueFactory valueFactory) 178 { 179 return this.value < other.value ? valueFactory.createIntegerValue(-1) : 180 this.value == other.value ? valueFactory.createIntegerValue(0) : 181 valueFactory.createIntegerValue(1); 182 } 183 184 185 187 public boolean isSpecific() 188 { 189 return true; 190 } 191 192 193 195 public boolean equals(Object object) 196 { 197 return object != null && 198 this.getClass() == object.getClass() && 199 this.value == ((SpecificFloatValue)object).value; 200 } 201 202 203 public int hashCode() 204 { 205 return this.getClass().hashCode() ^ Float.floatToIntBits(value); 206 } 207 208 209 public String toString() 210 { 211 return "f:"+value; 212 } 213 } 214 | Popular Tags |