Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/org/parts3492/partslib/PARTsCandle.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
13 changes: 7 additions & 6 deletions src/org/parts3492/partslib/PARTsUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,14 @@ 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.
*
* @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:
Expand Down Expand Up @@ -171,15 +168,19 @@ public double to(PARTsUnitType unitType) {
}
}

public double getValueAsDouble() {
return this.value;
}

/**
* Converts current unit into the requested unit.
*
* @param unitType The target {@link org.parts3492.partslib.PARTsUnit.PARTsUnitType
* 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 */
Expand Down
Loading