diff --git a/src/org/parts3492/partslib/PARTsCandle.java b/src/org/parts3492/partslib/PARTsCandle.java index 5e3cb48..4fcc69f 100644 --- a/src/org/parts3492/partslib/PARTsCandle.java +++ b/src/org/parts3492/partslib/PARTsCandle.java @@ -171,7 +171,8 @@ public PARTsCandle(String className, int canID, int ledLength, String canBusName /*---------------------------------- Custom Private Functions ---------------------------------*/ protected void setColor(Color color) { setControl(new EmptyAnimation(0)); - setControl(new SolidColor(0, LED_LENGTH).withColor(new RGBWColor(color.r, color.g, color.b))); + setControl( + new SolidColor(0, LED_LENGTH).withColor(new RGBWColor(color.r, color.g, color.b))); } protected void setNoColor() { diff --git a/src/org/parts3492/partslib/PARTsUnit.java b/src/org/parts3492/partslib/PARTsUnit.java index 838495a..e0845f6 100644 --- a/src/org/parts3492/partslib/PARTsUnit.java +++ b/src/org/parts3492/partslib/PARTsUnit.java @@ -72,9 +72,6 @@ public PARTsUnitType getUnitType() { * @param unitType The target unit. * @return Converted unit in double. */ - public PARTsUnit toPARTsUnit(PARTsUnitType unitType) { - return new PARTsUnit(to(unitType), unitType); - } /** * Converts current unit into the requested unit. @@ -82,7 +79,7 @@ public PARTsUnit toPARTsUnit(PARTsUnitType unitType) { * @param unitType The target unit. * @return Converted unit in double. */ - public double to(PARTsUnitType unitType) { + private double convertValue(PARTsUnitType unitType) { String message = "No to type for unit."; switch (this.unitType) { case Angle: @@ -171,6 +168,10 @@ public double to(PARTsUnitType unitType) { } } + public double getValueAsDouble() { + return this.value; + } + /** * Converts current unit into the requested unit. * @@ -178,8 +179,8 @@ public double to(PARTsUnitType unitType) { * PARTsUnitType}. * @return The converted {@link org.parts3492.partslib.PARTsUnit PARTsUnit}. */ - public PARTsUnit as(PARTsUnitType unitType) { - return new PARTsUnit(to(unitType), unitType); + public PARTsUnit to(PARTsUnitType unitType) { + return new PARTsUnit(convertValue(unitType), unitType); } // * DIRECT STATIC CONVERSIONS */