summaryrefslogtreecommitdiff
path: root/src/org/unitConverter/UnitsDatabase.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/unitConverter/UnitsDatabase.java')
-rwxr-xr-xsrc/org/unitConverter/UnitsDatabase.java11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/org/unitConverter/UnitsDatabase.java b/src/org/unitConverter/UnitsDatabase.java
index 4d41735..3af1c8d 100755
--- a/src/org/unitConverter/UnitsDatabase.java
+++ b/src/org/unitConverter/UnitsDatabase.java
@@ -393,8 +393,6 @@ public final class UnitsDatabase {
final Unit unit = this.getUnit(baseAndExponent[0]);
if (unit instanceof LinearUnit) {
base = (LinearUnit) unit;
- } else if (unit instanceof BaseUnit) {
- base = ((BaseUnit) unit).asLinearUnit();
} else
throw new IllegalArgumentException("Base of exponientation must be a linear or base unit.");
}
@@ -464,7 +462,7 @@ public final class UnitsDatabase {
// parse the expression
// start with an "empty" unit then apply operations on it
- LinearUnit unit = SI.SI.getBaseUnit(UnitDimension.EMPTY).asLinearUnit();
+ LinearUnit unit = SI.SI.getBaseUnit(UnitDimension.EMPTY);
boolean dividing = false;
// if I'm just creating an alias, just create one instead of going through the parsing process
@@ -567,8 +565,6 @@ public final class UnitsDatabase {
// try to turn the value into a linear unit
if (valueUnit instanceof LinearUnit) {
value = (LinearUnit) valueUnit;
- } else if (valueUnit instanceof BaseUnit) {
- value = ((BaseUnit) valueUnit).asLinearUnit();
} else
throw new IllegalArgumentException("Only linear and base units can be exponientated.");
}
@@ -594,10 +590,7 @@ public final class UnitsDatabase {
// the unitsfile is looking for a linear unit
if (!this.containsUnitName(part))
throw new IllegalArgumentException("Unrecognized unit name \"" + part + "\".");
- Unit other = this.getUnit(part);
- if (other instanceof BaseUnit) {
- other = ((BaseUnit) other).asLinearUnit();
- }
+ final Unit other = this.getUnit(part);
if (other instanceof LinearUnit) {
if (dividing) {
unit = unit.dividedBy((LinearUnit) other);