|
@@ -74,31 +74,33 @@ public class HolonSwitch extends AbstractCpsObject {
|
|
|
public HolonSwitch(AbstractCpsObject obj) {
|
|
|
super(obj);
|
|
|
super.setName(obj.getName());
|
|
|
- setManualState(((HolonSwitch)obj).getActiveManual());
|
|
|
+ setManualState(((HolonSwitch) obj).getActiveManual());
|
|
|
setAutoState(true);
|
|
|
setActiveAt(true);
|
|
|
for (int i = 0; i < activeAt.length; i++) {
|
|
|
- activeAt[i] = ((HolonSwitch)obj).getActiveAt()[i];
|
|
|
+ activeAt[i] = ((HolonSwitch) obj).getActiveAt()[i];
|
|
|
}
|
|
|
setGraphPoints(new LinkedList<Point>());
|
|
|
- for (Point p :((HolonSwitch)obj).getGraphPoints()) {
|
|
|
- this.graphPoints.add(new Point((int)p.getX(), (int)p.getY()));
|
|
|
+ for (Point p : ((HolonSwitch) obj).getGraphPoints()) {
|
|
|
+ this.graphPoints.add(new Point((int) p.getX(), (int) p.getY()));
|
|
|
}
|
|
|
- setManualMode(((HolonSwitch)obj).getManualMode());
|
|
|
+ setManualMode(((HolonSwitch) obj).getManualMode());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Calculates the state of the Switch.
|
|
|
*/
|
|
|
public void switchState() {
|
|
|
- if (manualMode) {
|
|
|
- if (this.manualActive == true) {
|
|
|
- setImage("/Images/switch-off.png");
|
|
|
- } else {
|
|
|
- setImage("/Images/switch-on.png");
|
|
|
- }
|
|
|
- this.manualActive = !manualActive;
|
|
|
+ if (!manualMode) {
|
|
|
+ setManualMode(true);
|
|
|
+ }
|
|
|
+ if (this.manualActive == true) {
|
|
|
+ setImage("/Images/switch-off.png");
|
|
|
+ } else {
|
|
|
+ setImage("/Images/switch-on.png");
|
|
|
}
|
|
|
+ this.manualActive = !manualActive;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -225,7 +227,8 @@ public class HolonSwitch extends AbstractCpsObject {
|
|
|
/**
|
|
|
* Set the overall value of the Switch (manual mode).
|
|
|
*
|
|
|
- * @param mode the mode (boolean)
|
|
|
+ * @param mode
|
|
|
+ * the mode (boolean)
|
|
|
*/
|
|
|
public void setManualMode(boolean mode) {
|
|
|
manualMode = mode;
|