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