|
@@ -1,19 +1,20 @@
|
|
|
package ui.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
abstract class CpsObject {
|
|
|
|
|
|
String objName;
|
|
|
|
|
|
String name;
|
|
|
|
|
|
- int ID;
|
|
|
+ int id;
|
|
|
|
|
|
String image;
|
|
|
|
|
|
- CpsObject[] connectedTo;
|
|
|
+ ArrayList<CpsObject> connectedTo;
|
|
|
|
|
|
- int xCoord;
|
|
|
- int yCoord;
|
|
|
+ Position position;
|
|
|
|
|
|
float energyIn;
|
|
|
float energyOut;
|
|
@@ -22,7 +23,8 @@ abstract class CpsObject {
|
|
|
* Constructor for an CpsObejct with an unique ID
|
|
|
*/
|
|
|
public CpsObject() {
|
|
|
- ID = IdCounter.nextId();
|
|
|
+ connectedTo = new ArrayList<CpsObject>();
|
|
|
+ position = new Position();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -45,7 +47,7 @@ abstract class CpsObject {
|
|
|
|
|
|
|
|
|
public int getID() {
|
|
|
- return ID;
|
|
|
+ return id;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -58,29 +60,22 @@ abstract class CpsObject {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public CpsObject[] getConnectedTo() {
|
|
|
+ public ArrayList<CpsObject> getConnectedTo() {
|
|
|
return connectedTo;
|
|
|
}
|
|
|
|
|
|
- public void setConnectedTo(CpsObject[] connectedTo) {
|
|
|
- this.connectedTo = connectedTo;
|
|
|
+ public void AddConnection(CpsObject toConnect) {
|
|
|
+ connectedTo.add(toConnect);
|
|
|
}
|
|
|
|
|
|
|
|
|
- public int getxCoord() {
|
|
|
- return xCoord;
|
|
|
- }
|
|
|
-
|
|
|
- public void setxCoord(int xCoord) {
|
|
|
- this.xCoord = xCoord;
|
|
|
- }
|
|
|
-
|
|
|
- public int getyCoord() {
|
|
|
- return yCoord;
|
|
|
+ public void setPos(int x, int y){
|
|
|
+ position.x = x;
|
|
|
+ position.y = y;
|
|
|
}
|
|
|
|
|
|
- public void setyCoord(int yCoord) {
|
|
|
- this.yCoord = yCoord;
|
|
|
+ public Position getPos(){
|
|
|
+ return position;
|
|
|
}
|
|
|
|
|
|
|