summaryrefslogtreecommitdiff
path: root/src/unitConverter/unit/BaseUnit.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/unitConverter/unit/BaseUnit.java')
-rwxr-xr-xsrc/unitConverter/unit/BaseUnit.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/unitConverter/unit/BaseUnit.java b/src/unitConverter/unit/BaseUnit.java
index d4a1e9c..fe36c45 100755
--- a/src/unitConverter/unit/BaseUnit.java
+++ b/src/unitConverter/unit/BaseUnit.java
@@ -108,6 +108,24 @@ public final class BaseUnit extends AbstractUnit {
return new LinearUnit(this, 1 / divisor);
}
+ @Override
+ public boolean equals(final Object obj) {
+ if (!(obj instanceof BaseUnit))
+ return false;
+ final BaseUnit other = (BaseUnit) obj;
+ return Objects.equals(this.getSystem(), other.getSystem())
+ && Objects.equals(this.getDimension(), other.getDimension());
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = result * prime + this.getSystem().hashCode();
+ result = result * prime + this.getDimension().hashCode();
+ return result;
+ }
+
/**
* Multiplies this unit by another unit.
*