|
@@ -1,5 +1,8 @@
|
|
package classes;
|
|
package classes;
|
|
|
|
|
|
|
|
+import java.awt.Point;
|
|
|
|
+import java.util.LinkedList;
|
|
|
|
+
|
|
public class HolonSwitch extends CpsObject {
|
|
public class HolonSwitch extends CpsObject {
|
|
/*
|
|
/*
|
|
* True, if this wire is working (capable of carrying electricity), else
|
|
* True, if this wire is working (capable of carrying electricity), else
|
|
@@ -7,6 +10,14 @@ public class HolonSwitch extends CpsObject {
|
|
*/
|
|
*/
|
|
boolean active;
|
|
boolean active;
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Energy at each point of the graph with 50 predefined points. At the
|
|
|
|
+ * beginning, it starts with all values at energy
|
|
|
|
+ */
|
|
|
|
+ boolean[] activeAt = new boolean[100];
|
|
|
|
+ //Points on the UnitGraph
|
|
|
|
+ LinkedList<Point> graphPoints = new LinkedList<>();
|
|
|
|
+
|
|
public HolonSwitch(String ObjName) {
|
|
public HolonSwitch(String ObjName) {
|
|
super(ObjName);
|
|
super(ObjName);
|
|
setState(false);
|
|
setState(false);
|
|
@@ -16,6 +27,7 @@ public class HolonSwitch extends CpsObject {
|
|
super(ObjName);
|
|
super(ObjName);
|
|
super.setName(obj);
|
|
super.setName(obj);
|
|
setState(false);
|
|
setState(false);
|
|
|
|
+ setActiveAt(true);
|
|
}
|
|
}
|
|
|
|
|
|
public HolonSwitch(CpsObject obj) {
|
|
public HolonSwitch(CpsObject obj) {
|
|
@@ -34,4 +46,34 @@ public class HolonSwitch extends CpsObject {
|
|
public void setState(boolean state){
|
|
public void setState(boolean state){
|
|
this.active = state;
|
|
this.active = state;
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return the Graph Points
|
|
|
|
+ */
|
|
|
|
+ public LinkedList<Point> getGraphPoints() {
|
|
|
|
+ return graphPoints;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param points, the Graph points
|
|
|
|
+ */
|
|
|
|
+ public void setGraphPoints(LinkedList<Point> points) {
|
|
|
|
+ this.graphPoints = points;
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * get the activeAt Array
|
|
|
|
+ */
|
|
|
|
+ public boolean[] getActiveAt() {
|
|
|
|
+ return activeAt;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param active, the default value
|
|
|
|
+ */
|
|
|
|
+ public void setActiveAt(boolean active) {
|
|
|
|
+ for (int i = 0; i < activeAt.length; i++) {
|
|
|
|
+ this.activeAt[i] = active;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|