Measure.java
1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.agl.util;
import com.adobe.agl.util.MeasureUnit;
public abstract class Measure {
private Number number;
private MeasureUnit unit;
protected Measure(Number number, MeasureUnit unit) {
if (number == null || unit == null) {
throw new NullPointerException();
}
this.number = number;
this.unit = unit;
}
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
try {
Measure m = (Measure)obj;
return this.unit.equals(m.unit) && Measure.numbersEqual(this.number, m.number);
}
catch (ClassCastException e) {
return false;
}
}
public static boolean numbersEqual(Number a, Number b) {
if (a.equals(b)) {
return true;
}
if (a.doubleValue() == b.doubleValue()) {
return true;
}
return false;
}
public int hashCode() {
return this.number.hashCode() ^ this.unit.hashCode();
}
public String toString() {
return this.number.toString() + ' ' + this.unit.toString();
}
public Number getNumber() {
return this.number;
}
public MeasureUnit getUnit() {
return this.unit;
}
}