|
33 | 33 | * Date: 2006-sep-08 |
34 | 34 | */ |
35 | 35 |
|
| 36 | +import com.codename1.compat.java.util.Objects; |
36 | 37 | import com.codename1.util.MathUtil; |
37 | 38 |
|
38 | | -import java.util.ArrayList; |
39 | | -import java.util.Arrays; |
40 | | -import java.util.HashMap; |
41 | | -import java.util.Objects; |
| 39 | +import java.util.ArrayList; |
| 40 | +import java.util.Arrays; |
| 41 | +import java.util.HashMap; |
42 | 42 |
|
43 | 43 | public final class UnitValue { |
44 | 44 | /** |
@@ -242,7 +242,7 @@ private UnitValue(float value, String unitStr, int unit, boolean isHor, int oper |
242 | 242 | if (oper < STATIC || oper > MID) |
243 | 243 | throw new IllegalArgumentException("Unknown Operation: " + oper); |
244 | 244 |
|
245 | | - if (oper > STATIC && (sub1 == null || sub2 == null)) |
| 245 | + if (oper > STATIC && (sub1 == null || sub2 == null)) |
246 | 246 | throw new IllegalArgumentException(oper + " Operation may not have null sub-UnitValues."); |
247 | 247 |
|
248 | 248 | this.value = value; |
@@ -619,33 +619,33 @@ public String getConstraintString() { |
619 | 619 | return LayoutUtil.getCCString(this); |
620 | 620 | } |
621 | 621 |
|
622 | | - public int hashCode() { |
623 | | - int result = 17; |
624 | | - result = 31 * result + Float.floatToIntBits(value); |
625 | | - result = 31 * result + unit; |
626 | | - result = 31 * result + oper; |
627 | | - result = 31 * result + (isHor ? 1 : 0); |
628 | | - result = 31 * result + (unitStr != null ? unitStr.hashCode() : 0); |
629 | | - result = 31 * result + (linkId != null ? linkId.hashCode() : 0); |
630 | | - result = 31 * result + Arrays.hashCode(subUnits); |
631 | | - return result; |
632 | | - } |
633 | | - |
634 | | - @Override |
635 | | - public boolean equals(Object obj) { |
636 | | - if (this == obj) { |
637 | | - return true; |
638 | | - } |
639 | | - if (!(obj instanceof UnitValue)) { |
640 | | - return false; |
641 | | - } |
642 | | - UnitValue other = (UnitValue) obj; |
643 | | - return Float.compare(value, other.value) == 0 |
644 | | - && unit == other.unit |
645 | | - && oper == other.oper |
646 | | - && isHor == other.isHor |
647 | | - && Objects.equals(unitStr, other.unitStr) |
648 | | - && Objects.equals(linkId, other.linkId) |
649 | | - && Arrays.equals(subUnits, other.subUnits); |
650 | | - } |
651 | | -} |
| 622 | + public int hashCode() { |
| 623 | + int result = 17; |
| 624 | + result = 31 * result + Float.floatToIntBits(value); |
| 625 | + result = 31 * result + unit; |
| 626 | + result = 31 * result + oper; |
| 627 | + result = 31 * result + (isHor ? 1 : 0); |
| 628 | + result = 31 * result + (unitStr != null ? unitStr.hashCode() : 0); |
| 629 | + result = 31 * result + (linkId != null ? linkId.hashCode() : 0); |
| 630 | + result = 31 * result + Arrays.hashCode(subUnits); |
| 631 | + return result; |
| 632 | + } |
| 633 | + |
| 634 | + @Override |
| 635 | + public boolean equals(Object obj) { |
| 636 | + if (this == obj) { |
| 637 | + return true; |
| 638 | + } |
| 639 | + if (!(obj instanceof UnitValue)) { |
| 640 | + return false; |
| 641 | + } |
| 642 | + UnitValue other = (UnitValue) obj; |
| 643 | + return Float.compare(value, other.value) == 0 |
| 644 | + && unit == other.unit |
| 645 | + && oper == other.oper |
| 646 | + && isHor == other.isHor |
| 647 | + && Objects.equals(unitStr, other.unitStr) |
| 648 | + && Objects.equals(linkId, other.linkId) |
| 649 | + && Arrays.equals(subUnits, other.subUnits); |
| 650 | + } |
| 651 | +} |
0 commit comments