Browse Source

Merge branch 'Ohne_Drag_and_Drop' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons into Ohne_Drag_and_Drop

# Conflicts:
#	src/tests/praktikumHolonsTestLoadAndStoreController.java
Teh-Hai Julian Zheng 7 years ago
parent
commit
fc744d6689
40 changed files with 968 additions and 583 deletions
  1. 3 0
      .checkstyle
  2. 6 0
      .project
  3. 11 11
      src/API/CpsAPI.java
  4. 1 1
      src/Interfaces/ObjectListener.java
  5. 89 46
      src/classes/AbstractCpsObject.java
  6. 15 10
      src/classes/Category.java
  7. 47 42
      src/classes/CpsEdge.java
  8. 3 3
      src/classes/CpsNode.java
  9. 36 32
      src/classes/HolonElement.java
  10. 52 46
      src/classes/HolonObject.java
  11. 92 19
      src/classes/HolonSwitch.java
  12. 28 15
      src/classes/HolonTransformer.java
  13. 22 5
      src/classes/Position.java
  14. 57 0
      src/classes/SubNet.java
  15. 0 27
      src/classes/subNet.java
  16. 9 9
      src/tests/praktikumHolonsAdapter.java
  17. 48 0
      src/tests/praktikumHolonsTestAutoSaveController.java
  18. 31 19
      src/tests/praktikumHolonsTestCanvasController.java
  19. 21 0
      src/tests/praktikumHolonsTestCategoryController.java
  20. 34 2
      src/tests/praktikumHolonsTestLoadAndStoreController.java
  21. 16 6
      src/tests/praktikumHolonsTestObjectController.java
  22. 5 1
      src/tests/praktikumHolonsTestSuite.java
  23. 3 3
      src/ui/controller/AutoSaveController.java
  24. 16 16
      src/ui/controller/CanvasController.java
  25. 3 3
      src/ui/controller/CategoryController.java
  26. 26 11
      src/ui/controller/Control.java
  27. 3 3
      src/ui/controller/LoadController.java
  28. 5 5
      src/ui/controller/MultiPurposeController.java
  29. 4 4
      src/ui/controller/ObjectController.java
  30. 191 149
      src/ui/controller/SimulationManager.java
  31. 8 8
      src/ui/controller/StoreController.java
  32. 14 14
      src/ui/model/Model.java
  33. 6 3
      src/ui/model/idCounter.java
  34. 7 3
      src/ui/model/idCounterElem.java
  35. 3 3
      src/ui/view/AddElementPopUp.java
  36. 3 3
      src/ui/view/AddObjectPopUp.java
  37. 29 39
      src/ui/view/GUI.java
  38. 13 14
      src/ui/view/MyCanvas.java
  39. 1 1
      src/ui/view/SimulationMenu.java
  40. 7 7
      src/ui/view/searchPopUp.java

+ 3 - 0
.checkstyle

@@ -1,6 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+  <local-check-config name="Checkstyle_BP" location="/home/jessey/Downloads/Checkstyle_BP" type="external" description="">
+    <additional-data name="protect-config-file" value="false"/>
+  </local-check-config>
   <fileset name="all" enabled="true" check-config-name="BP Configuration" local="false">
     <file-match-pattern match-pattern="." include-pattern="true"/>
   </fileset>

+ 6 - 0
.project

@@ -10,8 +10,14 @@
 			<arguments>
 			</arguments>
 		</buildCommand>
+		<buildCommand>
+			<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
 	</buildSpec>
 	<natures>
 		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
 	</natures>
 </projectDescription>

+ 11 - 11
src/API/CpsAPI.java

@@ -4,10 +4,10 @@ import java.awt.Color;
 import java.util.ArrayList;
 
 import classes.CpsEdge;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonObject;
 import classes.HolonSwitch;
-import classes.subNet;
+import classes.SubNet;
 import ui.controller.Control;
 import ui.controller.SimulationManager;
 
@@ -24,7 +24,7 @@ public class CpsAPI {
 	 * a SubNet contains all Components
 	 * @return all SubNets on Canvas
 	 */
-	public ArrayList<subNet> getSubNets(){
+	public ArrayList<SubNet> getSubNets(){
 		simManager.searchForSubNets();
 		return simManager.getSubNets();
 	}
@@ -33,7 +33,7 @@ public class CpsAPI {
 	 * 
 	 * @return all Objects on Canvas in no specific order
 	 */
-	public ArrayList<CpsObject> getAllObjOnCanvas(){
+	public ArrayList<AbstractCpsObject> getAllObjOnCanvas(){
 
 		return controller.getModel().getObjectsOnCanvas();
 	}
@@ -44,7 +44,7 @@ public class CpsAPI {
 	 */
 	public ArrayList<CpsEdge> getAllEdges(){
 		ArrayList<CpsEdge> result = new ArrayList<CpsEdge>();
-		for(subNet sN: getSubNets()){
+		for(SubNet sN: getSubNets()){
 			result.addAll(sN.getEdges());
 		}
 		return result;
@@ -56,7 +56,7 @@ public class CpsAPI {
 	 */
 	public ArrayList<HolonSwitch> getAllSwitches(){
 		ArrayList<HolonSwitch> result = new ArrayList<HolonSwitch>();
-		for(subNet sN: getSubNets()){
+		for(SubNet sN: getSubNets()){
 			result.addAll(sN.getSwitches());
 		}
 		return result;
@@ -64,7 +64,7 @@ public class CpsAPI {
 	
 	public ArrayList<HolonObject> getAllHolonObjects(){
 		ArrayList<HolonObject> result = new ArrayList<HolonObject>();
-		for(subNet sN: getSubNets()){
+		for(SubNet sN: getSubNets()){
 			result.addAll(sN.getObjects());
 		}
 		return result;
@@ -95,7 +95,7 @@ public class CpsAPI {
 	 * @param toChange
 	 * @param color
 	 */
-	public void setBorderColorForObj(CpsObject toChange, Color color){
+	public void setBorderColorForObj(AbstractCpsObject toChange, Color color){
 		toChange.setBorderColor(color);
 	}
 	
@@ -104,8 +104,8 @@ public class CpsAPI {
 	 * @param objects
 	 * @param color
 	 */
-	public void setBorderColorForMultObj(ArrayList<CpsObject> objects, Color color){
-		for(CpsObject cps: objects){
+	public void setBorderColorForMultObj(ArrayList<AbstractCpsObject> objects, Color color){
+		for(AbstractCpsObject cps: objects){
 			setBorderColorForObj(cps, color);
 		}
 	}
@@ -114,7 +114,7 @@ public class CpsAPI {
 	 * resets the bordercolor of given object to default (white)
 	 * @param toReset
 	 */
-	public void resetBorderColor(CpsObject toReset){
+	public void resetBorderColor(AbstractCpsObject toReset){
 		toReset.setBorderColor(Color.WHITE);
 	}
 	

+ 1 - 1
src/Interfaces/ObjectListener.java

@@ -3,5 +3,5 @@ package Interfaces;
 import java.util.ArrayList;
 
 public interface ObjectListener {
-	public void onChange(ArrayList<classes.CpsObject> objects);
+	public void onChange(ArrayList<classes.AbstractCpsObject> objects);
 }

+ 89 - 46
src/classes/CpsObject.java → src/classes/AbstractCpsObject.java

@@ -2,8 +2,6 @@ package classes;
 
 import java.awt.Color;
 import java.util.ArrayList;
-import java.util.HashMap;
-
 import ui.model.idCounter;
 
 /**
@@ -14,13 +12,13 @@ import ui.model.idCounter;
  * @author Gruppe14
  *
  */
-public abstract class CpsObject {
-	/* Type of the Object */
+public abstract class AbstractCpsObject {
+	/* Type of the Object. */
 	String objName;
-	/* Name given by the user */
+	/* Name given by the user. */
 	String name;
 	/* ID of the Obj. */
-	int ID;
+	int id;
 	/* Path of the image for the Obj. */
 	String image;
 	/* Array of neighbors */
@@ -32,15 +30,20 @@ public abstract class CpsObject {
 	 * Stored
 	 */
 	String sav;
-	/* BorderColor the user sets */
-	Color BorderColor = Color.WHITE;
+	/* borderColor the user sets */
+	Color borderColor = Color.WHITE;
 	/* a Tag that can be used */
 	ArrayList<Integer> tags;
-
+	/* a Tag that can be used */
+	ArrayList<Integer> pseudoTags;
+	
 	/**
-	 * Constructor for a CpsObejct with an unique ID
+	 * Constructor for a CpsObejct with an unique ID.
+	 * 
+	 * @param objName
+	 *            of the Object
 	 */
-	public CpsObject(String objName) {
+	public AbstractCpsObject(String objName) {
 		setObjName(objName);
 		setName(objName);
 		setImage("/Images/Dummy_House.png");
@@ -54,7 +57,7 @@ public abstract class CpsObject {
 	 * @param obj
 	 *            Object to be copied
 	 */
-	public CpsObject(CpsObject obj) {
+	public AbstractCpsObject(AbstractCpsObject obj) {
 		setObjName(obj.getObjName());
 		setName(obj.getObjName());
 		setConnections(new ArrayList<CpsEdge>());
@@ -64,7 +67,7 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Getter for the type of the Object
+	 * Getter for the type of the Object.
 	 * 
 	 * @return String
 	 */
@@ -73,7 +76,7 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Set the type of Object
+	 * Set the type of Object.
 	 * 
 	 * @param objName
 	 *            String
@@ -83,7 +86,7 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Getter for the user-defined name (no unique)
+	 * Getter for the user-defined name (no unique).
 	 * 
 	 * @return String
 	 */
@@ -92,7 +95,7 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Set the name
+	 * Set the name.
 	 * 
 	 * @param name
 	 *            String
@@ -102,26 +105,26 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Getter of the unique ID
+	 * Getter of the unique ID.
 	 * 
 	 * @return int
 	 */
 	public int getID() {
-		return ID;
+		return id;
 	}
 
 	/**
-	 * Set the ID to a new one
+	 * Set the ID to a new one.
 	 * 
-	 * @param iD
+	 * @param id
 	 *            the iD to set
 	 */
-	public void setID(int ID) {
-		this.ID = ID;
+	public void setID(int id) {
+		this.id = id;
 	}
 
 	/**
-	 * Get the path of the image for the selected Object
+	 * Get the path of the image for the selected Object.
 	 * 
 	 * @return String
 	 */
@@ -130,7 +133,7 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Set the path of the image
+	 * Set the path of the image.
 	 * 
 	 * @param image
 	 *            the Image to set
@@ -140,7 +143,7 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * List of all existing connections
+	 * List of all existing connections.
 	 * 
 	 * @return the connections ArrayList
 	 */
@@ -149,7 +152,7 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Set a new ArrayList of connections (Update)
+	 * Set a new ArrayList of connections (Update).
 	 * 
 	 * @param arrayList
 	 *            the connections to set
@@ -159,7 +162,7 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * List of all existing connections
+	 * List of all existing connections.
 	 * 
 	 * @return the connections ArrayList
 	 */
@@ -168,17 +171,17 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Add a new connection to the selected Object
+	 * Add a new connection to the selected Object.
 	 * 
 	 * @param toConnect
 	 *            Edge
 	 */
-	public void AddConnection(CpsEdge toConnect) {
+	public void addConnection(CpsEdge toConnect) {
 		connections.add(toConnect);
 	}
 
 	/**
-	 * Set the position of the Object in the canvas
+	 * Set the position of the Object in the canvas.
 	 * 
 	 * @param pos
 	 *            Coordinates
@@ -188,7 +191,7 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Set the position of the Object in the canvas
+	 * Set the position of the Object in the canvas.
 	 * 
 	 * @param x
 	 *            X-Coord
@@ -200,15 +203,17 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Get the actual position of the Object
+	 * Get the actual position of the Object.
 	 * 
-	 * @return
+	 * @return Position Position of this Object
 	 */
 	public Position getPosition() {
 		return position;
 	}
 
 	/**
+	 * For save purpose.
+	 * 
 	 * @return the stored
 	 */
 	public String getSav() {
@@ -216,7 +221,9 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * @param stored
+	 * For save purpose.
+	 * 
+	 * @param sav
 	 *            the stored to set
 	 */
 	public void setSav(String sav) {
@@ -224,45 +231,46 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Get the color of the border
+	 * Get the color of the border.
 	 * 
 	 * @return the BorderColor
 	 */
 	public Color getBorderColor() {
-		return BorderColor;
+		return borderColor;
 	}
 
 	/**
-	 * Set the Border Color of this CpsObject
+	 * Set the Border Color of this CpsObject.
 	 * 
-	 * @param the
-	 *            BorderColor
+	 * @param c
+	 *          the BorderColor
 	 */
 	public void setBorderColor(Color c) {
-		this.BorderColor = c;
+		this.borderColor = c;
 	}
 
 	/**
-	 * Set the Color of the edges
+	 * Set the Color of the edges.
 	 * 
-	 * @param Color
+	 * @param color
 	 *            the Color to set
 	 */
 	public void setConnections(Color color) {
-		this.BorderColor = color;
+		this.borderColor = color;
 	}
 
 	/**
-	 * For internal purpose (energy flow)
+	 * For internal purpose (energy flow).
 	 * 
 	 * @param tag
+	 *            for internal purpose
 	 */
 	public void addTag(int tag) {
 		this.tags.add(tag);
 	}
 
 	/**
-	 * Get the actual tags
+	 * Get the actual tags.
 	 * 
 	 * @return ArrayList
 	 */
@@ -271,13 +279,48 @@ public abstract class CpsObject {
 	}
 
 	/**
-	 * Rest the tags to Null
+	 * Rest the tags to Null.
 	 */
 	public void resetTags() {
 		this.tags = new ArrayList<Integer>();
 	}
 
+	/**
+	 * For internal purpose (energy flow).
+	 * 
+	 * @param tags
+	 *            for internal purpose
+	 */
 	public void setTags(ArrayList<Integer> tags) {
 		this.tags = tags;
 	}
+
+	/**
+	 * For internal purpose (energy flow).
+	 * 
+	 * @param tags
+	 *            for internal purpose
+	 */
+	public void setPseudoTags(ArrayList<Integer> tags) {
+		this.pseudoTags= tags;
+	}
+	
+	/**
+	 * Get the pseudo tags.
+	 * 
+	 * @return ArrayList
+	 */
+	public ArrayList<Integer> getPseudoTags() {
+		return this.pseudoTags;
+	}
+	
+	/**
+	 * add a pseudo tag.
+	 * 
+	 * @return ArrayList
+	 */
+	public ArrayList<Integer> addPseudoTag() {
+		return this.pseudoTags;
+	}
+	
 }

+ 15 - 10
src/classes/Category.java

@@ -14,40 +14,45 @@ import java.util.HashMap;
 
 public class Category {
 	// objects: is a ArrayList of all Objects that belongs to the Category
-	private ArrayList<CpsObject> objects;
+	private ArrayList<AbstractCpsObject> objects;
 	// name: is a String chosen by the User
 	private String name;
 	// ObjIdx: Index of each Category that corresponds to the order in the tree
 	private HashMap<String, Integer> objIdx;
 
+	/**
+	 * Category Constructor.
+	 * 
+	 * @param name name of the Category
+	 */
 	public Category(String name) {
-		setObjects(new ArrayList<CpsObject>());
+		setObjects(new ArrayList<AbstractCpsObject>());
 		setName(name);
 		setObjIdx(new HashMap<String, Integer>());
 
 	}
 
 	/**
-	 * Getter for all CpsObjects
+	 * Getter for all CpsObjects.
 	 * 
 	 * @return the objects
 	 */
-	public ArrayList<CpsObject> getObjects() {
+	public ArrayList<AbstractCpsObject> getObjects() {
 		return objects;
 	}
 
 	/**
-	 * Set a new ArrayList of CpsObjects
+	 * Set a new ArrayList of CpsObjects.
 	 * 
 	 * @param objects
 	 *            the objects to set
 	 */
-	public void setObjects(ArrayList<CpsObject> objects) {
+	public void setObjects(ArrayList<AbstractCpsObject> objects) {
 		this.objects = objects;
 	}
 
 	/**
-	 * Getter the name of the Category
+	 * Getter the name of the Category.
 	 * 
 	 * @return the name
 	 */
@@ -56,7 +61,7 @@ public class Category {
 	}
 
 	/**
-	 * Set the name of the Category to a new one
+	 * Set the name of the Category to a new one.
 	 * 
 	 * @param name
 	 *            the name to set
@@ -66,7 +71,7 @@ public class Category {
 	}
 
 	/**
-	 * Getter of the Objects in the Tree with their respective order
+	 * Getter of the Objects in the Tree with their respective order.
 	 * 
 	 * @return the objIdx
 	 */
@@ -75,7 +80,7 @@ public class Category {
 	}
 
 	/**
-	 * Set a new sequence of Objects in the tree
+	 * Set a new sequence of Objects in the tree.
 	 * 
 	 * @param objIdx
 	 *            the objIdx to set

+ 47 - 42
src/classes/CpsEdge.java

@@ -27,23 +27,23 @@ public class CpsEdge {
 	// for internal use --> flow of electricity (simulation state)
 	ArrayList<Integer> tags;
 	// Source
-	CpsObject A;
+	AbstractCpsObject a;
 	// Destination
-	CpsObject B;
+	AbstractCpsObject b;
 
 	/**
 	 * Constructor without max. capacity (by default as 100)
 	 * 
-	 * @param A
+	 * @param a
 	 *            Source
-	 * @param B
+	 * @param b
 	 *            Destination
 	 */
-	public CpsEdge(CpsObject A, CpsObject B) {
-		setA(A);
-		setB(B);
-		this.A.AddConnection(this);
-		this.B.AddConnection(this);
+	public CpsEdge(AbstractCpsObject a, AbstractCpsObject b) {
+		setA(a);
+		setB(b);
+		this.a.addConnection(this);
+		this.b.addConnection(this);
 		this.maxCapacity = 100;
 		flow = 0;
 		isWorking = true;
@@ -52,16 +52,18 @@ public class CpsEdge {
 	/**
 	 * Constructor with a user-defined max. capacity
 	 * 
-	 * @param A
+	 * @param a
 	 *            Source
-	 * @param B
+	 * @param b
 	 *            Destination
-	 */
-	public CpsEdge(CpsObject A, CpsObject B, float maxCap) {
-		setA(A);
-		setB(B);
-		this.A.AddConnection(this);
-		this.B.AddConnection(this);
+	 * @param maxCap
+	 *            Maximum Capacity
+	 */
+	public CpsEdge(AbstractCpsObject a, AbstractCpsObject b, float maxCap) {
+		setA(a);
+		setB(b);
+		this.a.addConnection(this);
+		this.b.addConnection(this);
 		this.maxCapacity = maxCap;
 		flow = 0;
 		isWorking = true;
@@ -87,7 +89,7 @@ public class CpsEdge {
 	}
 
 	/**
-	 * Getter fot the current flow
+	 * Getter fot the current flow.
 	 * 
 	 * @return the flow
 	 */
@@ -96,7 +98,7 @@ public class CpsEdge {
 	}
 
 	/**
-	 * Set the flow into a new one
+	 * Set the flow into a new one.
 	 * 
 	 * @param flow
 	 *            the flow to set
@@ -105,104 +107,107 @@ public class CpsEdge {
 		this.flow = flow;
 		/**
 		 * if (flow <= maxCapacity || flow == -1) { isWorking = true; } else {
-		 * isWorking = false; state = false; }
+		 * isWorking = false; state = false;
 		 **/
 	}
 
 	/**
-	 * Calculates the state of the edge (see description of isWorking)
+	 * Calculates the state of the edge (see description of isWorking).
 	 * 
 	 * @param simMode
+	 *            Simulation Mode
 	 */
 
 	public void calculateState(boolean simMode) {
 		if (flow > maxCapacity && maxCapacity != -1) {
 			isWorking = false;
 		} else {
-			if (!simMode && flow <= maxCapacity) {
+			if (!simMode && (flow <= maxCapacity || maxCapacity == -1)) {
 				isWorking = true;
 			}
 		}
 	}
 
 	/**
-	 * Getter for the Source
+	 * Getter for the Source.
 	 * 
 	 * @return the a
 	 */
-	public CpsObject getA() {
-		return A;
+	public AbstractCpsObject getA() {
+		return a;
 	}
 
 	/**
-	 * Set the Source to a new one
+	 * Set the Source to a new one.
 	 * 
 	 * @param a
 	 *            the a to set
 	 */
-	public void setA(CpsObject a) {
-		A = a;
+	public void setA(AbstractCpsObject a) {
+		this.a = a;
 	}
 
 	/**
-	 * Getter for the destination
+	 * Getter for the destination.
 	 * 
 	 * @return the b
 	 */
-	public CpsObject getB() {
-		return B;
+	public AbstractCpsObject getB() {
+		return b;
 	}
 
 	/**
-	 * Set the Destination to a new one
+	 * Set the Destination to a new one.
 	 * 
 	 * @param b
 	 *            the b to set
 	 */
-	public void setB(CpsObject b) {
-		B = b;
+	public void setB(AbstractCpsObject b) {
+		this.b = b;
 	}
 
 	/**
-	 * Set the state manually to a new one
+	 * Set the state manually to a new one.
 	 * 
 	 * @param state
+	 *            the state
 	 */
 	public void setState(boolean state) {
 		isWorking = state;
 	}
 
 	/**
-	 * Getter for the status
+	 * Getter for the status.
 	 * 
-	 * @return
+	 * @return the state
 	 */
 	public boolean getState() {
 		return isWorking;
 	}
 
 	/**
-	 * set the tags into a new set of tags
+	 * set the tags into a new set of tags.
 	 * 
 	 * @param tags
+	 *            tags for this edge
 	 */
 	public void setTags(ArrayList<Integer> tags) {
 		this.tags = tags;
 	}
 
 	/**
-	 * Getter for the ArrayList of tags
+	 * Getter for the ArrayList of tags.
 	 * 
-	 * @return
+	 * @return tags tags for this edge
 	 */
 	public ArrayList<Integer> getTags() {
 		return tags;
 	}
 
 	/**
-	 * Add a new tag to the ArrayList
+	 * Add a new tag to the ArrayList.
 	 * 
-	 * @param tag
+	 * @param tag tag for the ArrayList
 	 */
 	public void addTag(int tag) {
 		tags.add(tag);

+ 3 - 3
src/classes/CpsNode.java

@@ -11,10 +11,10 @@ import ui.model.idCounter;
  * @author Gruppe14
  *
  */
-public class CpsNode extends CpsObject {
-
+public class CpsNode extends AbstractCpsObject {
+	
 	/**
-	 * Create a new node in the system with an user-defined name
+	 * Create a new node in the system with an user-defined name.
 	 * 
 	 * @param objName
 	 *            String

+ 36 - 32
src/classes/HolonElement.java

@@ -6,7 +6,7 @@ import ui.model.idCounterElem;
 
 /**
  * The class "HolonElement" represents any possible element that can be added to
- * a CpsObject (such as TV (consumer) or any energy source/producer)
+ * a CpsObject (such as TV (consumer) or any energy source/producer).
  * 
  * @author Gruppe14
  *
@@ -43,7 +43,7 @@ public class HolonElement {
 
 	/**
 	 * Create a new HolonElement with a user-defined name, amount of the same
-	 * element and energy per element
+	 * element and energy per element.
 	 * 
 	 * @param eleName
 	 *            String
@@ -63,9 +63,10 @@ public class HolonElement {
 	}
 
 	/**
-	 * Create a copy of the HolonElement given each one a new ID
+	 * Create a copy of the HolonElement given each one a new ID.
 	 * 
 	 * @param element
+	 *            element to copy
 	 */
 	public HolonElement(HolonElement element) {
 		setEleName(element.getEleName());
@@ -80,18 +81,18 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get the Array of energy (100 values)
+	 * Get the Array of energy (100 values).
 	 * 
-	 * @return Array of floats
+	 * @return energyAt Array of Floats
 	 */
 	public float[] getEnergyAt() {
 		return energyAt;
 	}
 
 	/**
-	 * Set energy to any value to the whole array
+	 * Set energy to any value to the whole array.
 	 * 
-	 * @param energy,
+	 * @param energy
 	 *            the value
 	 */
 	public void setEnergyAt(float energy) {
@@ -101,7 +102,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set energy to any value at a given position
+	 * Set energy to any value at a given position.
 	 * 
 	 * @param pos
 	 *            int
@@ -113,7 +114,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get the user-defined Name
+	 * Get the user-defined Name.
 	 * 
 	 * @return the name String
 	 */
@@ -122,7 +123,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set the name to any new name
+	 * Set the name to any new name.
 	 * 
 	 * @param name
 	 *            the name to set
@@ -132,7 +133,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get the actual amount of Elements in the selected Object
+	 * Get the actual amount of Elements in the selected Object.
 	 * 
 	 * @return the amount int
 	 */
@@ -141,7 +142,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set the amount of the Element in the selected Object
+	 * Set the amount of the Element in the selected Object.
 	 * 
 	 * @param amount
 	 *            the amount to set
@@ -151,7 +152,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get the energy value of the selected Element
+	 * Get the energy value of the selected Element.
 	 * 
 	 * @return the energy
 	 */
@@ -160,7 +161,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set the energy value of the selected Element
+	 * Set the energy value of the selected Element.
 	 * 
 	 * @param energy
 	 *            the energy to set
@@ -170,7 +171,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get the Status of the Element (see description of variables)
+	 * Get the Status of the Element (see description of variables).
 	 * 
 	 * @return the active
 	 */
@@ -179,7 +180,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set the Status of the Element (see description of variables)
+	 * Set the Status of the Element (see description of variables).
 	 * 
 	 * @param active
 	 *            the active to set
@@ -189,7 +190,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get Image path
+	 * Get Image path.
 	 * 
 	 * @return the image
 	 */
@@ -198,7 +199,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set Image path
+	 * Set Image path.
 	 * 
 	 * @param image
 	 *            the image to set
@@ -210,7 +211,7 @@ public class HolonElement {
 	/**
 	 * Multiply the amount of gadgets, given by the user, and the
 	 * consumption/production. If the switch isWorking is turned off for on
-	 * gadget, the energy of this gadget have to be subtracted
+	 * gadget, the energy of this gadget have to be subtracted.
 	 * 
 	 * @return totalEnergy (actual)
 	 */
@@ -220,7 +221,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get the energy value at a selected time x
+	 * Get the energy value at a selected time x.
 	 * 
 	 * @param x
 	 *            int
@@ -232,7 +233,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get the symbol of the value (see variable description)
+	 * Get the symbol of the value (see variable description).
 	 * 
 	 * @return the sign
 	 */
@@ -241,7 +242,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set symbol of the value
+	 * Set symbol of the value.
 	 * 
 	 * @param energy
 	 *            the sign to set
@@ -254,14 +255,16 @@ public class HolonElement {
 	}
 
 	/**
-	 * @return the stored
+	 * @return the stored.
 	 */
 	public String getSav() {
 		return sav;
 	}
 
 	/**
-	 * @param stored
+	 * for save purposes.
+	 * 
+	 * @param sav
 	 *            the stored to set
 	 */
 	public void setSav(String sav) {
@@ -269,7 +272,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get the actual object
+	 * Get the actual object.
 	 * 
 	 * @return the obj
 	 */
@@ -278,7 +281,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set the object to a new one
+	 * Set the object to a new one.
 	 * 
 	 * @param obj
 	 *            the obj to set
@@ -288,7 +291,7 @@ public class HolonElement {
 	}
 
 	/**
-	 * Get the points (values) in the graph
+	 * Get the points (values) in the graph.
 	 * 
 	 * @return the Graph Points
 	 */
@@ -297,9 +300,9 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set the points (values) in the graph
+	 * Set the points (values) in the graph.
 	 * 
-	 * @param points,
+	 * @param points
 	 *            the Graph points
 	 */
 	public void setGraphPoints(LinkedList<Point> points) {
@@ -307,18 +310,19 @@ public class HolonElement {
 	}
 
 	/**
-	 * Set the ID of the HolonElement (one time only)
+	 * Set the ID of the HolonElement (one time only).
 	 * 
 	 * @param id
+	 *            the id
 	 */
 	private void setId(int id) {
 		this.id = id;
 	}
 
 	/**
-	 * Get the Id of the selected HolonElement
+	 * Get the Id of the selected HolonElement.
 	 * 
-	 * @return
+	 * @return id the id
 	 */
 	public int getId() {
 		return id;

+ 52 - 46
src/classes/HolonObject.java

@@ -5,7 +5,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 
 import ui.controller.MultiPurposeController;
-import ui.model.idCounter;
 
 /**
  * The class HolonObject represents any Object on the system which capability of
@@ -15,7 +14,7 @@ import ui.model.idCounter;
  * @author Gruppe14
  *
  */
-public class HolonObject extends CpsObject {
+public class HolonObject extends AbstractCpsObject {
 	/*
 	 * Color of the actual state (red = no supplied, yellow = partially supplied
 	 * and green = supplied)
@@ -24,7 +23,7 @@ public class HolonObject extends CpsObject {
 	/* Array of all consumers */
 	private ArrayList<HolonElement> elements;
 	/* Array of all Indices of Elements */
-	private HashMap<String, Integer> EleIdx;
+	private HashMap<String, Integer> eleIdx;
 	/* Total of consumption */
 	private float currentEnergy;
 
@@ -36,37 +35,24 @@ public class HolonObject extends CpsObject {
 	/**
 	 * Constructor Set by default the name of the object equals to the category
 	 * name, until the user changes it.
-	 */
-	public HolonObject(String ObjName) {
-		super(ObjName);
-		setElements(new ArrayList<HolonElement>());
-		setEleIdx(new HashMap<String, Integer>());
-		setState();
-	}
-
-	/**
-	 * Constructor with a user-defined name
 	 * 
-	 * @param ObjName
-	 *            Type of Object
-	 * @param obj
-	 *            user-defined name
+	 * @param objName
+	 *            name of the Object
 	 */
-	public HolonObject(String ObjName, String obj) {
-		super(ObjName);
-		super.setName(obj);
+	public HolonObject(String objName) {
+		super(objName);
 		setElements(new ArrayList<HolonElement>());
 		setEleIdx(new HashMap<String, Integer>());
 		setState();
 	}
 
 	/**
-	 * Contructor of a copy of an Object
+	 * Contructor of a copy of an Object.
 	 * 
 	 * @param obj
 	 *            object to be copied
 	 */
-	public HolonObject(CpsObject obj) {
+	public HolonObject(AbstractCpsObject obj) {
 		super(obj);
 		setEleIdx(MultiPurposeController.copyHashMap(((HolonObject) obj).getEleIdx()));
 		setElements(copyElements(((HolonObject) obj).getElements()));
@@ -74,8 +60,8 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * sets the State, wether object is a producer, zero Energy, supplied or not
-	 * supplied
+	 * sets the State, wether object is a producer, zero Energy, supplied or
+	 * not.
 	 */
 	public void setState() {
 		if (getCurrentEnergy() > 0) {
@@ -97,7 +83,7 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * Getter for all Elements in the HolonObject
+	 * Getter for all Elements in the HolonObject.
 	 * 
 	 * @return the elements ArrayList
 	 */
@@ -106,7 +92,7 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * Set a new ArrayList with HolonElements into the HolonObject
+	 * Set a new ArrayList with HolonElements into the HolonObject.
 	 * 
 	 * @param elements
 	 *            the elements to set
@@ -115,13 +101,19 @@ public class HolonObject extends CpsObject {
 		this.elements = elements;
 	}
 
+	/**
+	 * adds an Element to the Object.
+	 * 
+	 * @param element
+	 *            the Element to add
+	 */
 	public void addElements(HolonElement element) {
 		elements.add(element);
 	}
 
 	/**
 	 * Doesn't take into account which timestep is watched, calculates the max
-	 * values
+	 * values.
 	 * 
 	 * @return the currentEnergy
 	 */
@@ -137,7 +129,7 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * Getter for the current energy at a given timestep
+	 * Getter for the current energy at a given timestep.
 	 * 
 	 * @param x
 	 *            timestep
@@ -155,7 +147,7 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * deletes Element at a given index
+	 * deletes Element at a given index.
 	 * 
 	 * @param idx
 	 *            index
@@ -165,7 +157,7 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * String of all consumers in this HolonObject
+	 * String of all consumers in this HolonObject.
 	 * 
 	 * @return all the names of this HolonObject separated by "," each object
 	 */
@@ -182,29 +174,30 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * Getter index of all elements in the HolonObject
+	 * Getter index of all elements in the HolonObject.
 	 * 
 	 * @return the eleIdx
 	 */
 	public HashMap<String, Integer> getEleIdx() {
-		return EleIdx;
+		return eleIdx;
 	}
 
 	/**
-	 * Set the indexes of all elements
+	 * Set the indexes of all elements.
 	 * 
 	 * @param eleIdx
 	 *            the eleIdx to set
 	 */
 	public void setEleIdx(HashMap<String, Integer> eleIdx) {
-		EleIdx = eleIdx;
+		this.eleIdx = eleIdx;
 	}
 
 	/**
-	 * Copy all Elements into a New Array
+	 * Copy all Elements into a New Array.
 	 * 
 	 * @param arr
-	 * @return
+	 *            to copy
+	 * @return the copy of arr
 	 */
 	public ArrayList<HolonElement> copyElements(ArrayList<HolonElement> arr) {
 		ArrayList<HolonElement> newArr = new ArrayList<>();
@@ -215,23 +208,23 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * Get the state of the Object
+	 * Get the state of the Object.
 	 * 
-	 * @return state
+	 * @return state the State of the Element
 	 */
 	public int getState() {
 		return this.state;
 	}
 
 	/**
-	 * Set the state of the Object
+	 * Set the state of the Object.
 	 * 
-	 * @param supplied
+	 * @param state
 	 *            boolean if the Object is fully supplied
 	 */
-	public void setState(int st) {
-		this.state = st;
-		switch (st) {
+	public void setState(int state) {
+		this.state = state;
+		switch (state) {
 		case 0:
 			stateColor = Color.WHITE;
 			break;
@@ -254,7 +247,7 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * Search for the element with the name
+	 * Search for the element with the name.
 	 * 
 	 * @param name
 	 *            name of the object to be searched
@@ -271,7 +264,7 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
-	 * Search for the element with the id
+	 * Search for the element with the id.
 	 * 
 	 * @param id
 	 *            id of the element to be founded
@@ -288,9 +281,11 @@ public class HolonObject extends CpsObject {
 	}
 
 	/**
+	 * Check if Partially Supplied.
 	 * 
 	 * @param x
-	 * @return
+	 *            current Iteration
+	 * @return boolean is partially supplied
 	 */
 	public boolean checkIfPartiallySupplied(int x) {
 		if (getElements().size() == 0) {
@@ -318,10 +313,21 @@ public class HolonObject extends CpsObject {
 		}
 	}
 
+	/**
+	 * Set the State Color.
+	 * 
+	 * @param color
+	 *            the Color
+	 */
 	public void setColor(Color color) {
 		stateColor = color;
 	}
 
+	/**
+	 * Get the Color.
+	 * 
+	 * @return stateColor the Color
+	 */
 	public Color getColor() {
 		return stateColor;
 	}

+ 92 - 19
src/classes/HolonSwitch.java

@@ -3,7 +3,22 @@ package classes;
 import java.awt.Point;
 import java.util.LinkedList;
 
-public class HolonSwitch extends CpsObject {
+/**
+ * The class HolonSwitch represents a Switch, which can be turned on and off.
+ * 
+ * @author Gruppe14
+ *
+ */
+public class HolonSwitch extends AbstractCpsObject {
+
+	/**
+	 * The class HolonSwitch represents an Object in the system, that has the
+	 * capacity of manipulate the electricity flow. The switch can be manage
+	 * automatically through a graph or direct manually.
+	 * 
+	 * @author Gruppe14
+	 *
+	 */
 	/*
 	 * manual state True, if this wire is working (capable of carrying
 	 * electricity), else false
@@ -29,24 +44,28 @@ public class HolonSwitch extends CpsObject {
 	// Points on the UnitGraph
 	LinkedList<Point> graphPoints = new LinkedList<>();
 
-	public HolonSwitch(String ObjName) {
-		super(ObjName);
-		setManualState(true);
-		setAutoState(true);
-		setActiveAt(true);
-		setManualMode(false);
-	}
-
-	public HolonSwitch(String ObjName, String obj) {
-		super(ObjName);
-		super.setName(obj);
+	/**
+	 * Create a new HolonSwitch with the default name ("Switch"), a default
+	 * value of automatic handle and active status.
+	 * 
+	 * @param objName
+	 *            String
+	 */
+	public HolonSwitch(String objName) {
+		super(objName);
 		setManualState(true);
 		setAutoState(true);
 		setActiveAt(true);
 		setManualMode(false);
 	}
 
-	public HolonSwitch(CpsObject obj) {
+	/**
+	 * Create a copy of an existing HolonSwitch.
+	 * 
+	 * @param obj
+	 *            the Object to copy
+	 */
+	public HolonSwitch(AbstractCpsObject obj) {
 		super(obj);
 		super.setName(obj.getName());
 		setManualState(true);
@@ -55,6 +74,9 @@ public class HolonSwitch extends CpsObject {
 		setManualMode(false);
 	}
 
+	/**
+	 * Calculates the state of the Switch.
+	 */
 	public void switchState() {
 		if (manualMode) {
 			if (this.manualActive == true) {
@@ -65,15 +87,27 @@ public class HolonSwitch extends CpsObject {
 			this.manualActive = !manualActive;
 		}
 	}
-	
-	public boolean getState(int timeStep){
-		if(manualMode){
+
+	/**
+	 * Getter for the status of the Switch at a given timestep.
+	 * 
+	 * @param timeStep
+	 *            int
+	 * @return state value
+	 */
+	public boolean getState(int timeStep) {
+		if (manualMode) {
 			return this.manualActive;
 		} else {
 			return getActiveAt()[timeStep];
 		}
 	}
 
+	/**
+	 * Overall status of the switch (manual or automatic mode).
+	 * 
+	 * @return boolean the State
+	 */
 	public boolean getState() {
 		if (manualMode) {
 			return this.manualActive;
@@ -83,16 +117,31 @@ public class HolonSwitch extends CpsObject {
 
 	}
 
+	/**
+	 * Change the state of the Switch to manual.
+	 * 
+	 * @param state
+	 *            the State
+	 */
 	public void setManualState(boolean state) {
 		this.manualActive = state;
 		setImage();
 	}
 
+	/**
+	 * Set the state of the Switch to automatic.
+	 * 
+	 * @param state
+	 *            the State
+	 */
 	public void setAutoState(boolean state) {
 		this.autoActive = state;
 		setImage();
 	}
 
+	/**
+	 * Set Image of the Switch.
+	 */
 	private void setImage() {
 		if (manualMode) {
 			if (this.manualActive == false) {
@@ -110,6 +159,8 @@ public class HolonSwitch extends CpsObject {
 	}
 
 	/**
+	 * For automatic use only (throught the graph).
+	 * 
 	 * @return the Graph Points
 	 */
 	public LinkedList<Point> getGraphPoints() {
@@ -117,7 +168,9 @@ public class HolonSwitch extends CpsObject {
 	}
 
 	/**
-	 * @param points,
+	 * Set the values of the switch in the graph (auto. mode only).
+	 * 
+	 * @param points
 	 *            the Graph points
 	 */
 	public void setGraphPoints(LinkedList<Point> points) {
@@ -125,18 +178,28 @@ public class HolonSwitch extends CpsObject {
 	}
 
 	/**
-	 * get the activeAt Array
+	 * All values of the graph for the selected Switch (only auto-Mode) get the
+	 * activeAt Array.
+	 * 
+	 * @return boolean[] the States of each Iteration
 	 */
 	public boolean[] getActiveAt() {
 		return activeAt;
 	}
 
+	/**
+	 * Returns the ManualState.
+	 * 
+	 * @return boolean Manual State
+	 */
 	public boolean getActiveManual() {
 		return this.manualActive;
 	}
 
 	/**
-	 * @param active,
+	 * Set the value of the Switch.
+	 * 
+	 * @param active
 	 *            the default value
 	 */
 	public void setActiveAt(boolean active) {
@@ -145,10 +208,20 @@ public class HolonSwitch extends CpsObject {
 		}
 	}
 
+	/**
+	 * Set the overall value of the Switch (manual mode).
+	 * 
+	 * @param mode the mode (boolean)
+	 */
 	public void setManualMode(boolean mode) {
 		manualMode = mode;
 	}
 
+	/**
+	 * Get manualmode state.
+	 * 
+	 * @return boolean manual mode state
+	 */
 	public boolean getManualMode() {
 		return manualMode;
 	}

+ 28 - 15
src/classes/HolonTransformer.java

@@ -1,6 +1,12 @@
 package classes;
-
-public class HolonTransformer extends CpsObject {
+/**
+ * The class HolonTransformer represents a Transformer that transforms a flow to a lower flow.
+ * Transforemer are not used in the current State of the Project but could be used the future.
+ * 
+ * @author Gruppe14
+ *
+ */
+public class HolonTransformer extends AbstractCpsObject {
 
 	/* Ratio of the transformer */
 	float transformRatio;
@@ -14,25 +20,27 @@ public class HolonTransformer extends CpsObject {
 
 	/**
 	 * Constructor Set type of object (Transformer), its transform ratio and the
-	 * default name ("Transformer");
+	 * default name ("Transformer").
+	 * 
+	 * @param objName name for the Object
 	 */
-	public HolonTransformer(String ObjName) {
-		super(ObjName);
+	public HolonTransformer(String objName) {
+		super(objName);
 	}
 
-	public HolonTransformer(String ObjName, String obj) {
-		super(ObjName);
-		super.setName(obj);
-	}
-
-	public HolonTransformer(CpsObject obj) {
+	/**
+	 * Copy of the Object.
+	 * 
+	 * @param obj the Object to Copy
+	 */
+	public HolonTransformer(AbstractCpsObject obj) {
 		super(obj);
 		this.setTransformRatio(((HolonTransformer) obj).getTransformRatio());
 		this.setTransformFixed(((HolonTransformer) obj).getTransformFixed());
 	}
 
 	/**
-	 * Set transform ratio
+	 * Set transform ratio.
 	 * 
 	 * @param ratio
 	 *            desired ratio
@@ -42,7 +50,7 @@ public class HolonTransformer extends CpsObject {
 	}
 
 	/**
-	 * Output the actual ratio of the transformer
+	 * Output the actual ratio of the transformer.
 	 * 
 	 * @return actual ratio of the transformer
 	 */
@@ -51,7 +59,7 @@ public class HolonTransformer extends CpsObject {
 	}
 
 	/**
-	 * Set fixed Transform Value
+	 * Set fixed Transform Value.
 	 * 
 	 * @param fixed
 	 *            desired fixed Transform Value
@@ -61,7 +69,7 @@ public class HolonTransformer extends CpsObject {
 	}
 
 	/**
-	 * Output the actual fixed Transform Value
+	 * Output the actual fixed Transform Value.
 	 * 
 	 * @return actual fixed Transform Value
 	 */
@@ -69,6 +77,11 @@ public class HolonTransformer extends CpsObject {
 		return this.transformFixed;
 	}
 
+	/**
+	 * Get the Output of the Transformer.
+	 * 
+	 * @return The Output
+	 */
 	public float getOutput() {
 		float output = 0;
 		return output;

+ 22 - 5
src/classes/Position.java

@@ -1,16 +1,33 @@
 package classes;
 
+/**
+ * Coordinates of an Object on the canvas with a (int) x-coord and a (int).
+ * y-coord
+ * 
+ * @author Gruppe14
+ *
+ */
 public class Position {
 	public int x;
 	public int y;
-	
-	public Position(int x, int y){
+
+	/**
+	 * Constructor with an positive x and y coord on the canvas.
+	 * 
+	 * @param x
+	 *            int
+	 * @param y
+	 *            int
+	 */
+	public Position(int x, int y) {
 		this.x = x;
 		this.y = y;
 	}
-	
-	//default Constructor
-	public Position(){
+
+	/**
+	 * Default constructor without defined position.
+	 */
+	public Position() {
 		this.x = -1;
 		this.y = -1;
 	}

+ 57 - 0
src/classes/SubNet.java

@@ -0,0 +1,57 @@
+package classes;
+
+import java.util.ArrayList;
+
+/**
+ * The class "subNet" represents ....
+ * 
+ * @author Gruppe14
+ *
+ */
+public class SubNet {
+	private ArrayList<HolonObject> subNetObjects;
+	private ArrayList<CpsEdge> subNetEdges;
+	private ArrayList<HolonSwitch> subNetSwitches;
+
+	/**
+	 * Constructor for a Subnet.
+	 * 
+	 * @param objects
+	 *            Objects in the Subnet
+	 * @param edges
+	 *            Edges in the Subnet
+	 * @param switches
+	 *            Switches in the Subnet
+	 */
+	public SubNet(ArrayList<HolonObject> objects, ArrayList<CpsEdge> edges, ArrayList<HolonSwitch> switches) {
+		subNetObjects = objects;
+		subNetEdges = edges;
+		subNetSwitches = switches;
+	}
+
+	/**
+	 * Return all Objects in the Subnet.
+	 * 
+	 * @return all Objects in the Subnet
+	 */
+	public ArrayList<HolonObject> getObjects() {
+		return subNetObjects;
+	}
+	/**
+	 * Return all Edges in the Subnet.
+	 * 
+	 * @return all Edges in the Subnet
+	 */
+	public ArrayList<CpsEdge> getEdges() {
+		return subNetEdges;
+	}
+
+	/**
+	 * Return all Switches in the Subnet.
+	 * 
+	 * @return all Switches in the Subnet
+	 */
+	public ArrayList<HolonSwitch> getSwitches() {
+		return subNetSwitches;
+	}
+}

+ 0 - 27
src/classes/subNet.java

@@ -1,27 +0,0 @@
-package classes;
-
-import java.util.ArrayList;
-
-public class subNet {
-	private ArrayList<HolonObject> subNetObjects;
-	private ArrayList<CpsEdge> subNetEdges;
-	private ArrayList<HolonSwitch> subNetSwitches;
-	
-	public subNet(ArrayList<HolonObject> objects, ArrayList<CpsEdge> edges, ArrayList<HolonSwitch> switches){
-		subNetObjects = objects;
-		subNetEdges = edges;
-		subNetSwitches = switches;
-	}
-	
-	public ArrayList<HolonObject> getObjects(){
-		return subNetObjects;
-	}
-	
-	public ArrayList<CpsEdge> getEdges(){
-		return subNetEdges;
-	}
-	
-	public ArrayList<HolonSwitch> getSwitches(){
-		return subNetSwitches;
-	}
-}

+ 9 - 9
src/tests/praktikumHolonsAdapter.java

@@ -19,8 +19,8 @@ public class praktikumHolonsAdapter {
 
 	
 	/**
-	 * Generate Sequence of Categories from A - ZZZ
-	 * @param arr
+	 * Generate Sequence of Categories from A - ZZZ.
+	 * @param arr ArrayList of Categories
 	 */
 	public void generateCategories(ArrayList<Category> arr) {
 		for (int i = 1; i < 18279; i++) {
@@ -29,8 +29,8 @@ public class praktikumHolonsAdapter {
 	}
 	
 	/**
-	 * Generate Sequence of Objects from A - ZZZ
-	 * @param arr
+	 * Generate Sequence of Objects from A - ZZZ.
+	 * @param arr ArrayList of Categories
 	 */
 	public void generateObjects(ArrayList<CpsObject> arr) {
 		for (int i = 1; i < 18279; i++) {
@@ -39,8 +39,8 @@ public class praktikumHolonsAdapter {
 	}
 	
 	/**
-	 * Generate Sequence of Elements from A - ZZZ
-	 * @param arr
+	 * Generate Sequence of Elements from A - ZZZ.
+	 * @param arr ArrayList of Categories
 	 */
 	public void generateElements(ArrayList<HolonElement> arr) {
 		for (int i = 1; i < 18279; i++) {
@@ -49,9 +49,9 @@ public class praktikumHolonsAdapter {
 	}
 	
 	/**
-	 * Generate Alphabetical Sequences
-	 * @param n
-	 * @return
+	 * Generate Alphabetical Sequences.
+	 * @param n Generator
+	 * @return A generated Alphabetical Sequence
 	 */
 	public String generate(int n) {
 	    char[] buf = new char[(int) floor(log(25 * (n + 1)) / log(26))];

+ 48 - 0
src/tests/praktikumHolonsTestAutoSaveController.java

@@ -1,5 +1,53 @@
 package tests;
 
+import java.io.File;
+
+import org.junit.Before;
+
+import ui.controller.CanvasController;
+import ui.controller.CategoryController;
+import ui.controller.LoadController;
+import ui.controller.MultiPurposeController;
+import ui.controller.ObjectController;
+import ui.controller.StoreController;
+import ui.model.Model;
+import ui.model.idCounter;
+
 public class praktikumHolonsTestAutoSaveController {
+	protected praktikumHolonsAdapter adapter;
+	protected Model model;
+	protected MultiPurposeController mp;
+	protected CategoryController cg;
+	protected CanvasController cvs;
+	protected ObjectController obj;
+	protected StoreController storeController;
+	protected LoadController loadController;
+	protected idCounter id;
+	protected String path = System.getProperty("user.home") + "/HolonGUI/Test/";
+
+	/**
+	 * Setup for the test.
+	 */
+	@Before
+	public void setUp() {
+		adapter = new praktikumHolonsAdapter();
+		model = new Model();
+		mp = new MultiPurposeController(model);
+		cg = new CategoryController(model, mp);
+		cvs = new CanvasController(model, mp);
+		obj = new ObjectController(model, mp);
+		storeController = new StoreController(model);
+		loadController = new LoadController(model, cg, cvs, obj, mp);
+		// cg.initCategories();
+		// obj.initHolonElements();
+		File file = new File(path);
+		file.mkdirs();
+	}
+
+	/**
+	 *  kommentar hier hin.
+	 */
+	public void autoSaveMinimal() {
 
+	}
 }

+ 31 - 19
src/tests/praktikumHolonsTestCanvasController.java

@@ -1,20 +1,20 @@
 package tests;
 
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
+import classes.AbstractCpsObject;
 import classes.CpsEdge;
-import classes.CpsObject;
 import classes.HolonObject;
 import classes.HolonSwitch;
+
 import ui.controller.CanvasController;
 import ui.controller.CategoryController;
 import ui.controller.MultiPurposeController;
 import ui.model.Model;
 import ui.model.idCounter;
 
+import org.junit.Test;
+import org.junit.Before;
+import static org.junit.Assert.assertTrue;
+
 public class praktikumHolonsTestCanvasController {
 
 	protected praktikumHolonsAdapter adapter;
@@ -23,6 +23,9 @@ public class praktikumHolonsTestCanvasController {
 	protected CategoryController cg;
 	protected CanvasController controller;
 
+	/**
+	 * Setup for the tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -33,9 +36,12 @@ public class praktikumHolonsTestCanvasController {
 		idCounter.setCounter(1);
 	}
 
+	/**
+	 * Tests adding objects.
+	 */
 	@Test
 	public void testAddingObjects() {
-		//just adding a few things
+		// just adding a few things
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 0);
 		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
 		assertTrue("ID of the Object does not Match", mp.searchByID(1).getName().equals("Power Plant"));
@@ -68,7 +74,9 @@ public class praktikumHolonsTestCanvasController {
 		controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 10);
 	}
-
+	/**
+	 * Tests deleting Objects.
+	 */
 	@Test(expected = NullPointerException.class)
 	public void testDeletingObject() {
 		// Adding Objects on Canvas.. without Coordinates
@@ -97,37 +105,41 @@ public class praktikumHolonsTestCanvasController {
 		controller.deleteObjectOnCanvas(mp.searchByID(4));
 	}
 
+	/**
+	 * Tests adding and deleting Edges.
+	 */
 	@Test
 	public void testAddingAndDeletingEdges() {
-		HolonObject A = new HolonObject("A");
-		controller.addNewObject(new HolonObject(A));
+		HolonObject a = new HolonObject("A");
+		controller.addNewObject(new HolonObject(a));
 		int n = 0;
 
-		//creates vertices A - Z
+		// creates vertices A - Z
 		for (int i = 2; i < 27; i++) {
-			//adds Object on canvas
+			// adds Object on canvas
 			HolonObject temp = new HolonObject(adapter.generate(i));
 			controller.addNewObject(new HolonObject(temp));
-			//connect current vertice with all other vertices
-			for (CpsObject cps : model.getObjectsOnCanvas()) {
+			// connect current vertice with all other vertices
+			for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 				if (!cps.equals(mp.searchByID(i)))
 					controller.addEdgeOnCanvas(new CpsEdge(mp.searchByID(i), cps));
 			}
 
-			//test how many connections current vertice got
+			// test how many connections current vertice got
 			assertTrue("Number of Connections does not Match", mp.searchByID(i).getConnectedTo().size() == i - 1);
 			// some mathematical shit we got here. actually just means if its a
 			// complete graph -> all vertices connected all other vertices
 			n = model.getObjectsOnCanvas().size();
 			assertTrue("Number of Edges does not Match", model.getEdgesOnCanvas().size() == (n * (n - 1)) / 2);
 		}
-		//same as above
+		// same as above
 		n = model.getObjectsOnCanvas().size();
 		assertTrue("Number of Edges does not Match", model.getEdgesOnCanvas().size() == (n * (n - 1)) / 2);
-		
-		//here starts the deleting
+
+		// here starts the deleting
 		controller.removeEdgesOnCanvas(mp.searchEdge(13, 14));
-		assertTrue("Number of Connection of Vertice M does not Match", mp.searchByID(13).getConnections().size() == model.getObjectsOnCanvas().size() - 2);
+		assertTrue("Number of Connection of Vertice M does not Match",
+				mp.searchByID(13).getConnections().size() == model.getObjectsOnCanvas().size() - 2);
 		assertTrue("Edge-M-N was not deleted", mp.searchEdge(13, 14) == null);
 
 		controller.deleteObjectOnCanvas(mp.searchByID(13));

+ 21 - 0
src/tests/praktikumHolonsTestCategoryController.java

@@ -17,6 +17,9 @@ public class praktikumHolonsTestCategoryController {
 	protected MultiPurposeController mp;
 	protected CategoryController controller;
 
+	/**
+	 * Setup for the Tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -25,6 +28,9 @@ public class praktikumHolonsTestCategoryController {
 		controller = new CategoryController(model, mp);
 	}
 
+	/**
+	 * tests for the Initial Categories.
+	 */
 	@Test
 	public void testInitialCategories() {
 		assertTrue("Number of Categories is not 3", model.getCategories().size() == 3);
@@ -36,6 +42,9 @@ public class praktikumHolonsTestCategoryController {
 				mp.searchCatObj(mp.searchCat("Component"), "Switch") instanceof HolonObject);
 	}
 
+	/**
+	 * Basic tests for adding new Categories.
+	 */
 	@Test
 	public void testAddingCategoriesMinimal() {
 		controller.addNewCategory("University");
@@ -51,6 +60,9 @@ public class praktikumHolonsTestCategoryController {
 				model.getCategories().get(6).getName().equals("Energy_1"));
 	}
 
+	/**
+	 * Basic tests for deleting Categories.
+	 */
 	@Test
 	public void testDeletingCategoriesMinimal() {
 		assertTrue("Number of Categories is not 3", model.getCategories().size() == 3);
@@ -63,6 +75,9 @@ public class praktikumHolonsTestCategoryController {
 		assertTrue("1st Category was not Component", model.getCategories().get(0).getName().equals("Component"));
 	}
 
+	/**
+	 * Extended tests for adding and deleting Categories.
+	 */
 	@Test
 	public void testAddingAndDeletingCategoriesExtended() {
 		for (int i = 1; i <= 50; i++) {
@@ -92,6 +107,9 @@ public class praktikumHolonsTestCategoryController {
 		assertEquals("Category does not match", model.getCategories().get(3).getName(), "L");
 	}
 
+	/**
+	 * Basic tests for adding and deleting Objects.
+	 */
 	@Test
 	public void testAddingAndDeletingObjectsMinimal() {
 		controller.addNewHolonObject(mp.searchCat("Energy"), "Power Plant", null, "");
@@ -116,6 +134,9 @@ public class praktikumHolonsTestCategoryController {
 		assertTrue("Number of Objects in Energy is not 4", mp.searchCat("Energy").getObjects().size() == 4);
 	}
 
+	/**
+	 * Extended tests for adding and deleting Objects.
+	 */
 	@Test
 	public void testAddingAndDeletingObjectsExtended() {
 

+ 34 - 2
src/tests/praktikumHolonsTestLoadAndStoreController.java

@@ -15,8 +15,12 @@ import com.sun.security.auth.UnixNumericGroupPrincipal;
 
 import classes.Category;
 import classes.CpsEdge;
+<<<<<<< HEAD
 import classes.CpsNode;
 import classes.CpsObject;
+=======
+import classes.AbstractCpsObject;
+>>>>>>> f49bbdc594b9971cf0d3e85ce4846d4b62bfe80a
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
@@ -48,6 +52,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 	protected idCounter id;
 	protected String path = System.getProperty("user.home") + "/HolonGUI/Test/";
 
+	/**
+	 * Setup for the Tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -64,6 +71,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		file.mkdirs();
 	}
 
+	/**
+	 * minimal tests for saving.
+	 */
 	@Test
 	public void testStoreMinimal() {
 		try {
@@ -87,6 +97,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 
+	/**
+	 * basic tests for saving.
+	 */
 	@Test
 	public void testStoreBasic() {
 
@@ -131,6 +144,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 
+	/**
+	 * advanced tests for saving.
+	 */
 	@Test
 	public void testStoreAdvanced() {
 
@@ -143,7 +159,7 @@ public class praktikumHolonsTestLoadAndStoreController {
 				h.setPosition(j * 50, i * 50);
 				cvs.addNewObject(h);
 				setGraphPoints(h);
-				for (CpsObject cps : model.getObjectsOnCanvas()) {
+				for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 					if (!cps.equals(h))
 						cvs.addEdgeOnCanvas(new CpsEdge(h, cps));
 				}
@@ -167,6 +183,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 
 	}
 
+	/**
+	 * minimal tests for loading a save file.
+	 */
 	@Test
 	public void testLoadMinimal() {
 		try {
@@ -202,6 +221,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 	
+	/**
+	 * basic tests for loading a save file.
+	 */
 	@Test
 	public void testLoadBasic() {
 		assertTrue("Non-Existant Category Exists", mp.searchCat("J") == null);
@@ -216,9 +238,15 @@ public class praktikumHolonsTestLoadAndStoreController {
 			assertTrue("Objects on Canvas is not 0", model.getObjectsOnCanvas().size() == 0);
 			assertTrue("Canvas File was not found", new File(path + "TestCanvasBasic.json").exists());
 			loadController.readJSON(path + "TestCanvasBasic.json");
+<<<<<<< HEAD
 			assertTrue("NUmber of Objects on Canvas does not match", model.getObjectsOnCanvas().size() == 11);
 			for (CpsObject obj : model.getObjectsOnCanvas()) {
 				assertTrue("Not instance of HolonObject", obj instanceof HolonObject || obj instanceof HolonSwitch);
+=======
+			assertTrue("NUmber of Objects on Canvas does not match", model.getObjectsOnCanvas().size() == 10);
+			for (AbstractCpsObject obj : model.getObjectsOnCanvas()) {
+				assertTrue("Not instance of HolonObject", obj instanceof HolonObject);
+>>>>>>> f49bbdc594b9971cf0d3e85ce4846d4b62bfe80a
 			}
 			
 			assertTrue("NUmber of Categories not match", model.getCategories().size() == 3);
@@ -244,6 +272,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 	
+	/**
+	 * advanced tests for loading a save file.
+	 */
 	@Test
 	public void testLoadAdvanced() {
 		
@@ -271,8 +302,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 	}
 
 	/**
+	 * sets the graph points in all elements of an Object.
 	 * 
-	 * @param obj
+	 * @param obj the Object
 	 */
 	public void setGraphPoints(HolonObject obj) {
 		LinkedList<Point> list = new LinkedList<>();

+ 16 - 6
src/tests/praktikumHolonsTestObjectController.java

@@ -1,13 +1,11 @@
 package tests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Before;
 import org.junit.Test;
 
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonObject;
 import ui.controller.CanvasController;
 import ui.controller.CategoryController;
@@ -24,6 +22,9 @@ public class praktikumHolonsTestObjectController {
 	protected CanvasController cvs;
 	protected ObjectController controller;
 
+	/**
+	 * Setup for the Tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -34,6 +35,9 @@ public class praktikumHolonsTestObjectController {
 		controller = new ObjectController(model, mp);
 	}
 
+	/**
+	 * Tests for the Initial HolonElements.
+	 */
 	@Test
 	public void testInitialHolonElements() {
 		assertTrue("Number of Elements does not Match",
@@ -51,6 +55,9 @@ public class praktikumHolonsTestObjectController {
 				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "") == null);
 	}
 
+	/**
+	 * Tests for adding and Deleting in Categories.
+	 */
 	@Test
 	public void testAddingAndDeletingInCategory() {
 		controller.addNewElementIntoCategoryObject("Building", "House", "A", 1, -10);
@@ -89,12 +96,15 @@ public class praktikumHolonsTestObjectController {
 				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "TV") == null);
 	}
 
+	/**
+	 * Tests for Adding and Deleting Objects on the Canvas.
+	 */
 	@Test
 	public void testAddingAndDeletingInCanvas() {
 		for (int i = 0; i < 100; i++) {
 			cvs.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
 		}
-		for (CpsObject cps : model.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			for (int i = 0; i < 27; i++) {
 				controller.addNewElementIntoCanvasObject(cps.getID(), adapter.generate(i), 1, -100);
 				assertTrue("Element:" + adapter.generate(i) + " was not Created", mp
@@ -116,12 +126,12 @@ public class praktikumHolonsTestObjectController {
 					.searchEle((HolonObject) mp.searchByID(cps.getID()), "B") != null);	
 		}
 		
-		for (CpsObject cps : model.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			int size = model.getSelectedCpsObjects().size();
 			controller.addSelectedObject(cps);
 			assertTrue("Size does not Match", model.getSelectedCpsObjects().size() == size +1);
 		}
-		for (CpsObject cps : model.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			System.out.println(model.getSelectedCpsObjects().size());
 			int size = model.getSelectedCpsObjects().size();
 			controller.deleteSelectedObject(cps);

+ 5 - 1
src/tests/praktikumHolonsTestSuite.java

@@ -7,7 +7,11 @@ import junit.framework.TestSuite;
 public class praktikumHolonsTestSuite {
 
 
-	//Test Suite
+	/**
+	 * Test Suite.
+	 * 
+	 * @return suite
+	 */
 	public static Test suite() {
 		TestSuite suite = new TestSuite("Tests for prakikum-holons");
 		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestCategoryController.class));

+ 3 - 3
src/ui/controller/AutoSaveController.java

@@ -31,9 +31,9 @@ public class AutoSaveController {
 
 	public void decreaseAutoSaveNr() {
 		currentSave = MODEL.getAutoSaveNr() - 1;
-//		if (currentSave < 0) {
-//			currentSave = max;
-//		}
+		// if (currentSave < 0) {
+		// currentSave = max;
+		// }
 		MODEL.setAutoSaveNr(currentSave);
 	}
 

+ 16 - 16
src/ui/controller/CanvasController.java

@@ -7,7 +7,7 @@ import Interfaces.CategoryListener;
 import Interfaces.ObjectListener;
 import classes.CpsEdge;
 import classes.CpsNode;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonObject;
 import classes.HolonSwitch;
 import classes.Position;
@@ -29,7 +29,7 @@ public class CanvasController {
 	 * @param object
 	 *            CpsObject to be added.
 	 */
-	public void addObject(CpsObject object) {
+	public void addObject(AbstractCpsObject object) {
 		MODEL.getCvsObjIdx().put(object.getID(), MODEL.getObjectsOnCanvas().size());
 		MODEL.getObjectsOnCanvas().add(object);
 		notifyObjListeners();
@@ -39,7 +39,7 @@ public class CanvasController {
 	 * 
 	 * @param object
 	 */
-	public void addNewObject(CpsObject object) {
+	public void addNewObject(AbstractCpsObject object) {
 		object.setSav("CVS");
 		object.setConnections(new ArrayList<CpsEdge>());
 		addObject(object);
@@ -61,11 +61,11 @@ public class CanvasController {
 	/**
 	 * Deletes an CpsObject on the Canvas and its connections
 	 * 
-	 * @param CpsObject
+	 * @param AbstractCpsObject
 	 */
-	public void deleteObjectOnCanvas(CpsObject obj) {
+	public void deleteObjectOnCanvas(AbstractCpsObject obj) {
 		CpsEdge e = null;
-		for (CpsObject cps : MODEL.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : MODEL.getObjectsOnCanvas()) {
 			for (CpsEdge p : cps.getConnections()) {
 				if (p.getA() == obj || p.getB() == obj) {
 					e = p;
@@ -105,7 +105,7 @@ public class CanvasController {
 	 */
 	@SuppressWarnings("unchecked")
 	public void copyObjects() {
-		MODEL.setClipboradObjects((ArrayList<CpsObject>) MODEL.getSelectedCpsObjects().clone());
+		MODEL.setClipboradObjects((ArrayList<AbstractCpsObject>) MODEL.getSelectedCpsObjects().clone());
 	}
 
 	/**
@@ -117,11 +117,11 @@ public class CanvasController {
 	public void pasteObjects(Point p) {
 		System.out.println("paste");
 		MODEL.getSelectedCpsObjects().clear();
-		CpsObject tCps = null;
+		AbstractCpsObject tCps = null;
 		int x = Integer.MAX_VALUE, y = Integer.MAX_VALUE;
 
 		// Location whre to copy the Elements
-		for (CpsObject cps : MODEL.getClipboradObjects()) {
+		for (AbstractCpsObject cps : MODEL.getClipboradObjects()) {
 			if (cps.getPosition().x < x) {
 				x = cps.getPosition().x;
 			}
@@ -130,10 +130,10 @@ public class CanvasController {
 			}
 		}
 
-		ArrayList<CpsObject> tempList = new ArrayList<>();
+		ArrayList<AbstractCpsObject> tempList = new ArrayList<>();
 
 		// Objects
-		for (CpsObject cps : MODEL.getClipboradObjects()) {
+		for (AbstractCpsObject cps : MODEL.getClipboradObjects()) {
 			if (cps instanceof HolonObject) {
 				tCps = new HolonObject((HolonObject) cps);
 			} else if (cps instanceof HolonSwitch) {
@@ -149,14 +149,14 @@ public class CanvasController {
 
 		// Edges
 		boolean newEdge = true;
-		for (CpsObject cps : MODEL.getClipboradObjects()) {
+		for (AbstractCpsObject cps : MODEL.getClipboradObjects()) {
 			System.out.println("Object edges: " + cps.getConnectedTo().size());
 			for (CpsEdge e : cps.getConnectedTo()) {
 				// A and B of e in the copied Elements?
 				if (MODEL.getClipboradObjects().indexOf(e.getA()) != -1
 						&& MODEL.getClipboradObjects().indexOf(e.getB()) != -1) {
-					CpsObject A = tempList.get(MODEL.getClipboradObjects().indexOf(e.getA()));
-					CpsObject B = tempList.get(MODEL.getClipboradObjects().indexOf(e.getB()));
+					AbstractCpsObject A = tempList.get(MODEL.getClipboradObjects().indexOf(e.getA()));
+					AbstractCpsObject B = tempList.get(MODEL.getClipboradObjects().indexOf(e.getB()));
 					//was this Edge created or not?
 					for (CpsEdge et : tempList.get(MODEL.getClipboradObjects().indexOf(cps)).getConnectedTo()) {
 						for (CpsEdge etA : et.getA().getConnectedTo()) {
@@ -191,9 +191,9 @@ public class CanvasController {
 	 */
 	@SuppressWarnings("unchecked")
 	public void cutObjects() {
-		MODEL.setClipboradObjects((ArrayList<CpsObject>) MODEL.getSelectedCpsObjects().clone());
+		MODEL.setClipboradObjects((ArrayList<AbstractCpsObject>) MODEL.getSelectedCpsObjects().clone());
 		
-		for (CpsObject cps : MODEL.getClipboradObjects()) {
+		for (AbstractCpsObject cps : MODEL.getClipboradObjects()) {
 			deleteObjectOnCanvas(cps);
 		}
 

+ 3 - 3
src/ui/controller/CategoryController.java

@@ -4,7 +4,7 @@ import java.util.ArrayList;
 
 import Interfaces.CategoryListener;
 import classes.Category;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
@@ -101,7 +101,7 @@ public class CategoryController {
 	 * @param object
 	 *            Object
 	 */
-	public void addObject(Category category, CpsObject object) {
+	public void addObject(Category category, AbstractCpsObject object) {
 		int i = 0;
 		while (mpC.searchCatObj(category, object.getObjName()) != null) {
 			if (object.getObjName().contains("_"))
@@ -163,7 +163,7 @@ public class CategoryController {
 		addObject(cat, holonSwitch);
 	}
 
-	public void removeObject(Category category, CpsObject cps) {
+	public void removeObject(Category category, AbstractCpsObject cps) {
 
 		mpC.decIdx(cps.getObjName(), category.getObjIdx());
 		category.getObjIdx().remove(cps.getObjName());

+ 26 - 11
src/ui/controller/Control.java

@@ -11,7 +11,7 @@ import Interfaces.CategoryListener;
 import classes.Category;
 import classes.CpsEdge;
 import classes.CpsNode;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.Position;
@@ -53,6 +53,7 @@ public class Control {
 		this.consoleController = new ConsoleController(MODEL);
 		autoPath = System.getProperty("user.home") + "/HolonGUI/Autosave/";
 		File dest = new File(autoPath);
+		deleteDirectory(dest);
 		dest.mkdirs();
 		try {
 			autoSave();
@@ -62,13 +63,27 @@ public class Control {
 		}
 	}
 
+	public void deleteDirectory(File path) {
+		if (path.exists()) {
+			File[] files = path.listFiles();
+			for (int i = 0; i < files.length; i++) {
+				if (files[i].isDirectory()) {
+					deleteDirectory(files[i]);
+				} else {
+					files[i].delete();
+				}
+			}
+			path.delete();
+		}
+	}
+
 	/* Operations for searching */
 
-	public CpsObject searchByID(int ID) {
+	public AbstractCpsObject searchByID(int ID) {
 		return multiPurposeController.searchByID(ID);
 	}
 
-	public CpsObject searchCategoryObject(String category, String object) {
+	public AbstractCpsObject searchCategoryObject(String category, String object) {
 		return multiPurposeController.searchCatObj(multiPurposeController.searchCat(category), object);
 	}
 
@@ -105,11 +120,11 @@ public class Control {
 		categoryController.deleteObject(cat, obj);
 	}
 
-	public void deleteSelectedObject(CpsObject obj) {
+	public void deleteSelectedObject(AbstractCpsObject obj) {
 		objectController.deleteSelectedObject(obj);
 	}
 
-	public void addSelectedObject(CpsObject obj) {
+	public void addSelectedObject(AbstractCpsObject obj) {
 		objectController.addSelectedObject(obj);
 	}
 
@@ -139,7 +154,7 @@ public class Control {
 		MODEL.setSelectedEdge(edge);
 	}
 
-	public void addObjectCanvas(CpsObject object) {
+	public void addObjectCanvas(AbstractCpsObject object) {
 		canvasController.addNewObject(object);
 		if (!(object instanceof CpsNode)) {
 			try {
@@ -155,7 +170,7 @@ public class Control {
 		objectController.setSelectedObjectID(id);
 	}
 
-	public void delCanvasObject(CpsObject obj) {
+	public void delCanvasObject(AbstractCpsObject obj) {
 		canvasController.deleteObjectOnCanvas(obj);
 		try {
 			autoSave();
@@ -182,7 +197,7 @@ public class Control {
 		objectController.deleteElement(obj, ele);
 	}
 
-	public void setClipboardObjects(ArrayList<CpsObject> list) {
+	public void setClipboardObjects(ArrayList<AbstractCpsObject> list) {
 		MODEL.setClipboradObjects(list);
 	}
 
@@ -313,7 +328,7 @@ public class Control {
 	public void addTextToConsole(String text, Color color, int p, boolean bold, boolean italic, boolean nl) {
 		consoleController.addTextToConsole(text, color, p, bold, italic, nl);
 	}
-	
+
 	/**
 	 * Print Text on the console in black and font size 12
 	 *
@@ -330,14 +345,14 @@ public class Control {
 	public void clearConsole() {
 		consoleController.clearConsole();
 	}
-	
+
 	/**
 	 * @return sets the timerSpeed
 	 */
 	public void setTimerSpeed(int t) {
 		globalController.setTimerSpeed(t);
 	}
-	
+
 	/**
 	 * @param isSimulation
 	 *            boolean for for isSimulation

+ 3 - 3
src/ui/controller/LoadController.java

@@ -16,7 +16,7 @@ import org.json.simple.parser.ParseException;
 import classes.Category;
 import classes.CpsEdge;
 import classes.CpsNode;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
@@ -75,7 +75,7 @@ public class LoadController {
 		}
 		if (mode.equals(MODE.ALL) || mode.equals(MODE.CANVAS)) {
 			MODEL.setCvsObjIdx(new HashMap<Integer, Integer>());
-			MODEL.setObjectsOnCanvas(new ArrayList<CpsObject>());
+			MODEL.setObjectsOnCanvas(new ArrayList<AbstractCpsObject>());
 			MODEL.setEdgesOnCanvas(new ArrayList<CpsEdge>());
 		}
 
@@ -172,7 +172,7 @@ public class LoadController {
 	 */
 	public void readCanvasObject(JSONArray arr) {
 		Iterator<Object> i = arr.iterator();
-		CpsObject cps = null;
+		AbstractCpsObject cps = null;
 
 		String type = next(i);
 

+ 5 - 5
src/ui/controller/MultiPurposeController.java

@@ -5,7 +5,7 @@ import java.util.Map.Entry;
 
 import classes.Category;
 import classes.CpsEdge;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import ui.model.Model;
@@ -42,7 +42,7 @@ public class MultiPurposeController {
 	 * @param list
 	 * @return
 	 */
-	public CpsObject searchCatObj(Category category, String object) {
+	public AbstractCpsObject searchCatObj(Category category, String object) {
 
 		Integer idx;
 
@@ -59,7 +59,7 @@ public class MultiPurposeController {
 	 * @param list
 	 * @return
 	 */
-	public CpsObject searchByID(int ID) {
+	public AbstractCpsObject searchByID(int ID) {
 
 		Integer idx;
 
@@ -92,8 +92,8 @@ public class MultiPurposeController {
 
 	public CpsEdge searchEdge(int a, int b) {
 
-		CpsObject A = searchByID(a);
-		CpsObject B = searchByID(b);
+		AbstractCpsObject A = searchByID(a);
+		AbstractCpsObject B = searchByID(b);
 
 		for (CpsEdge edge : MODEL.getEdgesOnCanvas()) {
 			// if (edge.getA().getObjName().equals(A.getObjName()) &&

+ 4 - 4
src/ui/controller/ObjectController.java

@@ -3,7 +3,7 @@ package ui.controller;
 import java.util.ArrayList;
 
 import classes.Category;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import ui.model.Model;
@@ -113,7 +113,7 @@ public class ObjectController {
 	 * 
 	 * @param Cpsobject
 	 */
-	public void deleteSelectedObject(CpsObject obj) {
+	public void deleteSelectedObject(AbstractCpsObject obj) {
 		MODEL.getSelectedCpsObjects().remove(obj);
 	}
 
@@ -122,7 +122,7 @@ public class ObjectController {
 	 * 
 	 * @param Cpsobject
 	 */
-	public void addSelectedObject(CpsObject obj) {
+	public void addSelectedObject(AbstractCpsObject obj) {
 		MODEL.getSelectedCpsObjects().add(obj);
 	}
 
@@ -172,7 +172,7 @@ public class ObjectController {
 	 * @param ArrayList
 	 *            of CpsObjects
 	 */
-	public void setClipboardObjects(ArrayList<CpsObject> list) {
+	public void setClipboardObjects(ArrayList<AbstractCpsObject> list) {
 		MODEL.setClipboradObjects(list);
 	}
 }

+ 191 - 149
src/ui/controller/SimulationManager.java

@@ -5,71 +5,72 @@ import java.util.HashMap;
 
 import classes.CpsEdge;
 import classes.CpsNode;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
-import classes.subNet;
+import classes.SubNet;
 import ui.model.Model;
 import ui.view.MyCanvas;
 
 public class SimulationManager {
 	private Model model;
-	private ArrayList<CpsObject> objectsToHandle;
+	private ArrayList<AbstractCpsObject> objectsToHandle;
 	private ArrayList<CpsEdge> allConnections;
-	private ArrayList<subNet> subNets;
+	private ArrayList<SubNet> subNets;
 	private MyCanvas canvas;
 	private int timeStep;
 	private boolean simMode;
 	private HashMap<Integer, Float> tagTable = new HashMap<Integer, Float>();
-	
-	public SimulationManager(Model m){
+
+	public SimulationManager(Model m) {
 		canvas = null;
 		model = m;
-		subNets = new ArrayList<subNet>();
+		subNets = new ArrayList<SubNet>();
 		simMode = model.getIsSimulation();
 	}
-	
-	
+
 	/**
 	 * calculates the flow of the edges and the supply for objects
+	 * 
 	 * @param x
 	 */
-	public void calculateStateForTimeStep(int x){
+	public void calculateStateForTimeStep(int x) {
 		simMode = model.getIsSimulation();
 		timeStep = x;
 		searchForSubNets();
-		for(subNet singleSubNet: subNets){
+		for (SubNet singleSubNet : subNets) {
 			ResetConnections(singleSubNet.getObjects().get(0), new ArrayList<Integer>(), new ArrayList<CpsEdge>());
 		}
-		for(subNet singleSubNet: subNets){
+		for (SubNet singleSubNet : subNets) {
 			float production = calculateEnergy("prod", singleSubNet, timeStep);
 			float consumption = calculateEnergy("cons", singleSubNet, timeStep);
-			float minConsumption = calculateMinimumEnergy( singleSubNet, timeStep);
+			float minConsumption = calculateMinimumEnergy(singleSubNet, timeStep);
 			setFlow(singleSubNet, simMode);
-			for(HolonObject hl: singleSubNet.getObjects()){
-				if(!(hl.getState() == 0) && !(hl.getState() == 3)){
-					for(int i = 0; i < hl.getConnections().size(); i++){
+			for (HolonObject hl : singleSubNet.getObjects()) {
+				if (!(hl.getState() == 0) && !(hl.getState() == 3)) {
+					for (int i = 0; i < hl.getConnections().size(); i++) {
 						CpsEdge edge = hl.getConnectedTo().get(i);
-						if(edge.getState() && edge.getFlow() > 0 || edge.getCapacity() == -1){
-							// 0 = no energy, 1 = not supplied, 2 = supplied, 3 = producer, 4 = partially supplied
-							if((production + consumption) >= 0){
+						if (edge.getState() && edge.getFlow() > 0 || edge.getCapacity() == -1) {
+							// 0 = no energy, 1 = not supplied, 2 = supplied, 3
+							// = producer, 4 = partially supplied
+							if ((production + consumption) >= 0) {
 								hl.setState(2);
 							}
-							if((production + consumption) < 0 ){
-								if((production + minConsumption) >= 0){
+							if ((production + consumption) < 0) {
+								if ((production + minConsumption) >= 0) {
 									hl.setState(4);
-								}else if(hl.checkIfPartiallySupplied(timeStep)){
+								} else if (hl.checkIfPartiallySupplied(timeStep)) {
 									hl.setState(4);
-								}else {
+								} else {
 									hl.setState(1);
 								}
 							}
 							break;
 						}
-							hl.setState(1);
+						hl.setState(1);
 					}
-					if(hl.checkIfPartiallySupplied(timeStep) && !(hl.getState() == 2)){
+					if (hl.checkIfPartiallySupplied(timeStep) && !(hl.getState() == 2)) {
 						hl.setState(4);
 					}
 				}
@@ -77,166 +78,203 @@ public class SimulationManager {
 		}
 		canvas.repaint();
 	}
-	
-	public void setFlow(subNet sN, boolean simulation){
-		if(simulation){
+
+	public void setFlow(SubNet sN, boolean simulation) {
+		if (simulation) {
 			setFlowSimulation(sN);
 		} else {
 			setFlowModelation(sN);
 		}
 	}
-	
-	public void setFlowModelation(subNet sN){
-		for(HolonObject hl: sN.getObjects()){
+
+	public void setFlowModelation(SubNet sN) {
+		for (HolonObject hl : sN.getObjects()) {
 			float energy = hl.getCurrentEnergyAtTimeStep(timeStep);
-			if(energy > 0){
-				for(CpsEdge e : sN.getEdges()){
+			if (energy > 0) {
+				for (CpsEdge e : sN.getEdges()) {
 					e.setFlow(e.getFlow() + energy);
 					e.calculateState(simMode);
 				}
 			}
 		}
 	}
-	
-	public void setFlowSimulation(subNet sN){
-		ArrayList<CpsObject> producers = new ArrayList<CpsObject>();
-		CpsObject tmp = null;
+
+	public void setFlowSimulation(SubNet sN) {
+		ArrayList<AbstractCpsObject> producers = new ArrayList<AbstractCpsObject>();
+		AbstractCpsObject tmp = null;
 		tagTable = new HashMap<Integer, Float>();
-		for(HolonObject hl: sN.getObjects()){
+		for (HolonObject hl : sN.getObjects()) {
 			float energy = hl.getCurrentEnergyAtTimeStep(timeStep);
-			if(energy > 0){
+			if (energy > 0) {
 				tagTable.put(hl.getID(), energy);
-				for(CpsEdge edge: hl.getConnections()){
-					if(edge.getState()){
-						if(edge.getA().getID() == hl.getID()){
+				hl.addTag(hl.getID());
+				for (CpsEdge edge : hl.getConnections()) {
+					if (edge.getState()) {
+						if (edge.getA().getID() == hl.getID()) {
 							edge.getB().addTag(hl.getID());
 							tmp = edge.getB();
 						}
-						if(edge.getB().getID() == hl.getID()){
+						if (edge.getB().getID() == hl.getID()) {
 							edge.getA().addTag(hl.getID());
 							tmp = edge.getA();
 						}
 						edge.setFlow(edge.getFlow() + energy);
 						edge.calculateState(true);
 						edge.addTag(hl.getID());
-						if(edge.getState() && !producers.contains(tmp)){
+						if (edge.getState() && !producers.contains(tmp)) {
 							producers.add(tmp);
 						}
 					}
 				}
 			}
 		}
-		setFlowSimRec(producers);
+		setFlowSimRec(producers, 0);
 	}
-	
-	public void setFlowSimRec(ArrayList<CpsObject> nodes){
-		ArrayList<CpsObject> newNodes = new ArrayList<CpsObject>();
-		CpsObject tmp = null;
-		if(nodes.size() != 0){
-			for(CpsObject cps: nodes){
-				for(CpsEdge edge: cps.getConnections()){
-					for(Integer tag: cps.getTag()){
-						if(edge.getState() && !(edge.getTags().contains(tag))){
+
+	public void setFlowSimRec(ArrayList<AbstractCpsObject> nodes, int iter) {
+		ArrayList<AbstractCpsObject> newNodes = new ArrayList<AbstractCpsObject>();
+		ArrayList<Integer> pseudoTags = new ArrayList<Integer>();
+		AbstractCpsObject tmp = null;
+		if (nodes.size() != 0) {
+			for (AbstractCpsObject cps : nodes) {
+				for (CpsEdge edge : cps.getConnections()) {
+					for (Integer tag : cps.getTag()) {
+						if (edge.getState() && !(edge.getTags().contains(tag))) {
 							edge.setFlow(edge.getFlow() + tagTable.get(tag));
-							System.out.println(cps.getID() + " has tags:" + getString(cps));
+							edge.calculateState(true);
 							edge.addTag(tag);
-							if(edge.getA().getID() == cps.getID()){
+							if (edge.getA().getID() == cps.getID()) {
 								tmp = edge.getB();
-								tmp.setTags(mergeLists(tmp.getTag(), cps.getTag()));
 							}
-							if(edge.getB().getID() == cps.getID()){
+							if (edge.getB().getID() == cps.getID()) {
 								tmp = edge.getA();
-								tmp.setTags(mergeLists(tmp.getTag(), cps.getTag()));
 							}
-							if(edge.getState() && !(newNodes.contains(tmp))){
+							if (tmp.getPseudoTags() != null) {
+								pseudoTags.addAll(tmp.getPseudoTags());
+							}
+							pseudoTags.addAll(cps.getTag());
+							tmp.setPseudoTags(mergeLists(tmp.getTag(), pseudoTags));
+							if (!edge.getState()) {
+								newNodes.remove(edge.getA());
+								newNodes.remove(edge.getB());
+								if (edge.getA().getID() == cps.getID()) {
+									edge.getB().getPseudoTags().removeAll(edge.getTags());
+
+								}
+								if (edge.getB().getID() == cps.getID()) {
+									edge.getA().getPseudoTags().removeAll(edge.getTags());
+								}
+							}
+							if (edge.getState() && !(newNodes.contains(tmp))) {
 								newNodes.add(tmp);
-							}	
+							}
 						}
 					}
-				edge.calculateState(true);
+					edge.calculateState(true);
 				}
 			}
-			setFlowSimRec(newNodes);
+			// printNodes(newNodes);
+			setPseudoTags(newNodes);
+			setFlowSimRec(newNodes, iter + 1);
+		}
+	}
+
+	public void setPseudoTags(ArrayList<AbstractCpsObject> nodes) {
+		for (AbstractCpsObject node : nodes) {
+			node.setTags(node.getPseudoTags());
 		}
 	}
-	
-	public String getString(CpsObject cps){
+
+	public void printNodes(ArrayList<AbstractCpsObject> nodes) {
+		System.out.println("new Nodes:");
+		for (AbstractCpsObject node : nodes) {
+			System.out.println(node.getID());
+		}
+	}
+
+	public String getString(ArrayList<Integer> tags) {
 		String result = "";
-		for(Integer i:cps.getTag()){
+		for (Integer i : tags) {
 			result = result + ", " + i;
 		}
 		return result;
 	}
-	
-	public ArrayList<Integer> mergeLists(ArrayList<Integer> A, ArrayList<Integer> B){
+
+	public ArrayList<Integer> mergeLists(ArrayList<Integer> A, ArrayList<Integer> B) {
 		ArrayList<Integer> result = new ArrayList<Integer>();
-		for(Integer i: A){
-			if(!(B.contains(i))){
+		for (Integer i : A) {
+			if (!(result.contains(i))) {
 				result.add(i);
 			}
 		}
-		result.addAll(B);
+		for (Integer j : B) {
+			if (!(result.contains(j))) {
+				result.add(j);
+			}
+		}
 		return result;
 	}
-	
-	public void ResetConnections(CpsObject cps, ArrayList<Integer> visitedObj, ArrayList<CpsEdge> visitedEdges){
+
+	public void ResetConnections(AbstractCpsObject cps, ArrayList<Integer> visitedObj,
+			ArrayList<CpsEdge> visitedEdges) {
 		visitedObj.add(cps.getID());
 		cps.resetTags();
-		for(CpsEdge e: cps.getConnections()){
-			if(!(visitedEdges.contains(e))){
+		for (CpsEdge e : cps.getConnections()) {
+			if (!(visitedEdges.contains(e))) {
 				e.setFlow(0);
 				e.calculateState(simMode);
 				e.setTags(new ArrayList<Integer>());
 				visitedEdges.add(e);
-				if(!(visitedObj.contains(e.getA().getID()))){
+				if (!(visitedObj.contains(e.getA().getID()))) {
 					ResetConnections(e.getA(), visitedObj, visitedEdges);
 					e.getA().resetTags();
 				}
-				if(!(visitedObj.contains(e.getB().getID()))){
+				if (!(visitedObj.contains(e.getB().getID()))) {
 					ResetConnections(e.getB(), visitedObj, visitedEdges);
 					e.getB().resetTags();
 				}
 			}
 		}
 	}
-	
+
 	/**
 	 * calculates the energy of either all producers or consumers
+	 * 
 	 * @param type
 	 * @param sN
 	 * @return
 	 */
-	public float calculateEnergy(String type, subNet sN, int x){
+	public float calculateEnergy(String type, SubNet sN, int x) {
 		float energy = 0;
-		for(HolonObject hl: sN.getObjects()){
-			if(type.equals("prod")){
-				if(hl.getCurrentEnergyAtTimeStep(x) > 0){
+		for (HolonObject hl : sN.getObjects()) {
+			if (type.equals("prod")) {
+				if (hl.getCurrentEnergyAtTimeStep(x) > 0) {
 					energy = energy + hl.getCurrentEnergyAtTimeStep(x);
 					hl.setState(3);
 				}
 			}
-			if(type.equals("cons")){
-				if(hl.getCurrentEnergyAtTimeStep(x) < 0){
+			if (type.equals("cons")) {
+				if (hl.getCurrentEnergyAtTimeStep(x) < 0) {
 					energy = energy + hl.getCurrentEnergyAtTimeStep(x);
 					hl.setState(1);
 				}
 			}
-			if(hl.getCurrentEnergyAtTimeStep(x) == 0){
+			if (hl.getCurrentEnergyAtTimeStep(x) == 0) {
 				hl.setState(0);
 			}
 		}
 		return energy;
 	}
-	
-	public float calculateMinimumEnergy(subNet sN, int x){
+
+	public float calculateMinimumEnergy(SubNet sN, int x) {
 		float min = 0;
 		float minElement = 0;
-		for(HolonObject hl: sN.getObjects()){
-			if(hl.getElements().size() > 0 && hl.getElements().get(0).getTotalEnergyAtTimeStep(x) < 0 ){
+		for (HolonObject hl : sN.getObjects()) {
+			if (hl.getElements().size() > 0 && hl.getElements().get(0).getTotalEnergyAtTimeStep(x) < 0) {
 				minElement = hl.getElements().get(0).getTotalEnergyAtTimeStep(x);
 			}
-			for(HolonElement he: hl.getElements()){
-				if(minElement < he.getTotalEnergyAtTimeStep(x) && he.getTotalEnergyAtTimeStep(x) < 0){
+			for (HolonElement he : hl.getElements()) {
+				if (minElement < he.getTotalEnergyAtTimeStep(x) && he.getTotalEnergyAtTimeStep(x) < 0) {
 					minElement = he.getTotalEnergyAtTimeStep(x);
 				}
 			}
@@ -244,152 +282,156 @@ public class SimulationManager {
 		}
 		return min;
 	}
-	
+
 	/**
 	 * generates all subNets from all objectsToHandle
 	 */
-	public void searchForSubNets(){
-		subNets = new ArrayList<subNet>();
+	public void searchForSubNets() {
+		subNets = new ArrayList<SubNet>();
 		boolean end = false;
 		int i = 0;
-		CpsObject cps;
-		if(objectsToHandle.size() > 0){
-			while(!end){
+		AbstractCpsObject cps;
+		if (objectsToHandle.size() > 0) {
+			while (!end) {
 				cps = objectsToHandle.get(i);
-				subNet singleSubNet = new subNet(new ArrayList<HolonObject>(), new ArrayList<CpsEdge>(), new ArrayList<HolonSwitch>());
+				SubNet singleSubNet = new SubNet(new ArrayList<HolonObject>(), new ArrayList<CpsEdge>(),
+						new ArrayList<HolonSwitch>());
 				singleSubNet = buildSubNet(cps, new ArrayList<Integer>(), singleSubNet);
-				if(singleSubNet.getObjects().size() != 0){
+				if (singleSubNet.getObjects().size() != 0) {
 					subNets.add(singleSubNet);
 				}
-				if(0 == objectsToHandle.size()){
+				if (0 == objectsToHandle.size()) {
 					end = true;
 				}
 			}
 		}
 	}
-	
+
 	/**
-	 * recursivly generates a subnet of all objects, that one specific object is connected to
+	 * recursivly generates a subnet of all objects, that one specific object is
+	 * connected to
+	 * 
 	 * @param cps
 	 * @param visited
 	 * @param sN
 	 * @return
 	 */
-	public subNet buildSubNet(CpsObject cps, ArrayList<Integer> visited, subNet sN){
+	public SubNet buildSubNet(AbstractCpsObject cps, ArrayList<Integer> visited, SubNet sN) {
 		visited.add(cps.getID());
-		if(cps instanceof HolonObject){
+		if (cps instanceof HolonObject) {
 			sN.getObjects().add((HolonObject) cps);
 		}
-		if(cps instanceof HolonSwitch){
+		if (cps instanceof HolonSwitch) {
 			sN.getSwitches().add((HolonSwitch) cps);
 		}
 		removeFromToHandle(cps.getID());
-		CpsObject A;
-		CpsObject B;
-		for(CpsEdge edge: cps.getConnections()){
+		AbstractCpsObject A;
+		AbstractCpsObject B;
+		for (CpsEdge edge : cps.getConnections()) {
 			A = edge.getA();
 			B = edge.getB();
-			if(!(cps instanceof HolonSwitch)){
-				if(!(sN.getEdges().contains(edge))){
+			if (!(cps instanceof HolonSwitch)) {
+				if (!(sN.getEdges().contains(edge))) {
 					sN.getEdges().add(edge);
 				}
 			}
-			if(!visited.contains(A.getID()) && legitState(A, cps)){
-					sN = buildSubNet(A, visited, sN);
+			if (!visited.contains(A.getID()) && legitState(A, cps)) {
+				sN = buildSubNet(A, visited, sN);
 			}
-			if(!visited.contains(B.getID()) && legitState(B, cps)){
-					sN = buildSubNet(B, visited, sN);
+			if (!visited.contains(B.getID()) && legitState(B, cps)) {
+				sN = buildSubNet(B, visited, sN);
 			}
 		}
 		return sN;
 	}
-	
-	public boolean legitState(CpsObject neighbor, CpsObject current){
-		if(current instanceof HolonSwitch){
-			if(((HolonSwitch) current).getState(timeStep)){
-				if(neighbor instanceof HolonSwitch){
-					if(((HolonSwitch) neighbor).getState(timeStep)){
+
+	public boolean legitState(AbstractCpsObject neighbor, AbstractCpsObject current) {
+		if (current instanceof HolonSwitch) {
+			if (((HolonSwitch) current).getState(timeStep)) {
+				if (neighbor instanceof HolonSwitch) {
+					if (((HolonSwitch) neighbor).getState(timeStep)) {
 						return true;
-					}else{
+					} else {
 						return false;
-						}
+					}
 				}
-			}else{
+			} else {
 				return false;
 			}
 		}
 		return true;
 	}
-	
+
 	/**
 	 * removes an Object that already has been handled with
+	 * 
 	 * @param id
 	 */
-	public void removeFromToHandle(int id){
-		for(int i = 0; i < objectsToHandle.size(); i++){
-			if(objectsToHandle.get(i).getID() == id){
+	public void removeFromToHandle(int id) {
+		for (int i = 0; i < objectsToHandle.size(); i++) {
+			if (objectsToHandle.get(i).getID() == id) {
 				objectsToHandle.remove(i);
 			}
 		}
 	}
-	
+
 	/**
 	 * ensures that objectsToHandle only contains HolonObjects
 	 */
-	public void cleanObjectsToHandle(){
-		for(int i = 0; i < objectsToHandle.size(); i++){
-			if(!(objectsToHandle.get(i) instanceof HolonObject)){
+	public void cleanObjectsToHandle() {
+		for (int i = 0; i < objectsToHandle.size(); i++) {
+			if (!(objectsToHandle.get(i) instanceof HolonObject)) {
 				objectsToHandle.remove(i);
 			}
 		}
 	}
-	
+
 	/**
 	 * copies the data of an array of Objects
+	 * 
 	 * @param toCopy
 	 */
-	public void copyObjects(ArrayList<CpsObject> toCopy){
-		objectsToHandle = new ArrayList<CpsObject>();
-		for(CpsObject cps: toCopy){
+	public void copyObjects(ArrayList<AbstractCpsObject> toCopy) {
+		objectsToHandle = new ArrayList<AbstractCpsObject>();
+		for (AbstractCpsObject cps : toCopy) {
 			objectsToHandle.add(cps);
 		}
 	}
-	
+
 	/**
 	 * Prints the Components auf all subnets
 	 */
-	public void printNet(){
-		for(int i = 0; i < subNets.size(); i++){
+	public void printNet() {
+		for (int i = 0; i < subNets.size(); i++) {
 			System.out.println("SUBNET NR:" + i);
 			System.out.println("  Objects:");
-			for(int j = 0; j < subNets.get(i).getObjects().size(); j++){
+			for (int j = 0; j < subNets.get(i).getObjects().size(); j++) {
 				HolonObject hl = subNets.get(i).getObjects().get(j);
 				System.out.println("    " + hl.getName() + " " + hl.getID());
 			}
 			System.out.println("  Edges:");
-			for(int j = 0; j < subNets.get(i).getEdges().size(); j++){
+			for (int j = 0; j < subNets.get(i).getEdges().size(); j++) {
 				CpsEdge edge = subNets.get(i).getEdges().get(j);
 				System.out.println("     " + edge.getA().getName() + " connected To " + edge.getB().getName());
 			}
 			System.out.println("  Switches:");
-			for(int j = 0; j < subNets.get(i).getSwitches().size(); j++){
+			for (int j = 0; j < subNets.get(i).getSwitches().size(); j++) {
 				HolonSwitch sw = subNets.get(i).getSwitches().get(j);
 				System.out.println("    " + sw.getName() + " " + sw.getID() + " State:" + sw.getActiveAt()[timeStep]);
 			}
 		}
 	}
-	
-	public void setCanvas(MyCanvas can){
+
+	public void setCanvas(MyCanvas can) {
 		canvas = can;
 	}
-	
-	public void reset(){
+
+	public void reset() {
 		copyObjects(model.getObjectsOnCanvas());
 	}
-	
-	public ArrayList<subNet> getSubNets(){
+
+	public ArrayList<SubNet> getSubNets() {
 		return subNets;
 	}
-	
-	
+
 }

+ 8 - 8
src/ui/controller/StoreController.java

@@ -10,7 +10,7 @@ import org.json.simple.JSONObject;
 
 import classes.Category;
 import classes.CpsEdge;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
@@ -118,7 +118,7 @@ public class StoreController {
 		int i = 1;
 
 		for (Category cats : MODEL.getCategories())
-			for (CpsObject cps : cats.getObjects()) {
+			for (AbstractCpsObject cps : cats.getObjects()) {
 				arr.add(getObjectType(cps));
 				arr.add(cps.getSav());
 				arr.add(cps.getObjName());
@@ -132,7 +132,7 @@ public class StoreController {
 
 		JSONArray arr = new JSONArray();
 		int i = 1;
-		for (CpsObject cps : MODEL.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : MODEL.getObjectsOnCanvas()) {
 			arr.add(getObjectType(cps));
 			arr.add(cps.getObjName());
 			arr.add(cps.getName());
@@ -156,7 +156,7 @@ public class StoreController {
 		int i = 1;
 
 		for (Category cats : MODEL.getCategories())
-			for (CpsObject cps : cats.getObjects())
+			for (AbstractCpsObject cps : cats.getObjects())
 				if (cps instanceof HolonObject)
 					for (HolonElement ele : ((HolonObject) cps).getElements()) {
 						arr.add(ele.getSav());
@@ -175,7 +175,7 @@ public class StoreController {
 		
 		JSONArray arr = new JSONArray();
 		int i = 1;
-		for (CpsObject cps : MODEL.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : MODEL.getObjectsOnCanvas()) {
 			if (cps instanceof HolonObject)
 				for (HolonElement ele : ((HolonObject) cps).getElements()) {
 					arr.add(ele.getSav());
@@ -222,7 +222,7 @@ public class StoreController {
 		int i = 1;
 
 		for (Category cats : MODEL.getCategories())
-			for (CpsObject cps : cats.getObjects())
+			for (AbstractCpsObject cps : cats.getObjects())
 				if (cps instanceof HolonObject)
 					for (HolonElement ele : ((HolonObject) cps).getElements())
 						if (!ele.getGraphPoints().isEmpty()) {
@@ -241,7 +241,7 @@ public class StoreController {
 							arr = new JSONArray();
 						}
 		i = 1;
-		for (CpsObject cps : MODEL.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : MODEL.getObjectsOnCanvas()) {
 			if (cps instanceof HolonObject)
 				for (HolonElement ele : ((HolonObject) cps).getElements())
 					if (!ele.getGraphPoints().isEmpty()) {
@@ -268,7 +268,7 @@ public class StoreController {
 	 * @param cps
 	 * @return
 	 */
-	public String getObjectType(CpsObject cps) {
+	public String getObjectType(AbstractCpsObject cps) {
 		if (cps instanceof HolonObject)
 			return "HolonObject";
 		if (cps instanceof HolonTransformer)

+ 14 - 14
src/ui/model/Model.java

@@ -10,7 +10,7 @@ import java.util.List;
 
 import classes.Category;
 import classes.CpsEdge;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import ui.controller.*;
 import ui.view.Console;
@@ -23,11 +23,11 @@ public class Model {
 	private static final int ITERATIONS = 100;
 	private int CUR_ITERATION = 0;
 	// ID of the Selected Object
-	private CpsObject selectedCpsObject = null;
+	private AbstractCpsObject selectedCpsObject = null;
 	private HolonElement selectedHolonElement;
 	private CpsEdge selectedEdge;
-	private ArrayList<CpsObject> selectedObjects = new ArrayList<CpsObject>();
-	private ArrayList<CpsObject> clipboardObjects = new ArrayList<CpsObject>();
+	private ArrayList<AbstractCpsObject> selectedObjects = new ArrayList<AbstractCpsObject>();
+	private ArrayList<AbstractCpsObject> clipboardObjects = new ArrayList<AbstractCpsObject>();
 	private Console console;
 
 	// Iteration Speed
@@ -54,7 +54,7 @@ public class Model {
 	 * Array of all CpsObjects in our canvas. It is set by default as an empty
 	 * list.
 	 */
-	private ArrayList<CpsObject> objectsOnCanvas;
+	private ArrayList<AbstractCpsObject> objectsOnCanvas;
 
 	private HashMap<String, Integer> cgIdx;
 	private HashMap<Integer, Integer> cvsObjIdx;
@@ -78,13 +78,13 @@ public class Model {
 	 */
 	public Model() {
 		setCategories(new ArrayList<Category>());
-		setObjectsOnCanvas(new ArrayList<CpsObject>());
+		setObjectsOnCanvas(new ArrayList<AbstractCpsObject>());
 		setEdgesOnCanvas(new ArrayList<CpsEdge>());
 		setCategoryListeners(new LinkedList<CategoryListener>());
 		setObjectListeners(new LinkedList<ObjectListener>());
 		setCgIdx(new HashMap<String, Integer>());
 		setCvsObjIdx(new HashMap<Integer, Integer>());
-		setClipboradObjects(new ArrayList<CpsObject>());
+		setClipboradObjects(new ArrayList<AbstractCpsObject>());
 	}
 
 	/**
@@ -123,7 +123,7 @@ public class Model {
 	/**
 	 * @return the objectsOnCanvas
 	 */
-	public ArrayList<CpsObject> getObjectsOnCanvas() {
+	public ArrayList<AbstractCpsObject> getObjectsOnCanvas() {
 		return objectsOnCanvas;
 	}
 
@@ -131,7 +131,7 @@ public class Model {
 	 * @param objectsOnCanvas
 	 *            the objectsOnCanvas to set
 	 */
-	public void setObjectsOnCanvas(ArrayList<CpsObject> objectsOnCanvas) {
+	public void setObjectsOnCanvas(ArrayList<AbstractCpsObject> objectsOnCanvas) {
 		this.objectsOnCanvas = objectsOnCanvas;
 	}
 
@@ -215,15 +215,15 @@ public class Model {
 		return selectedID;
 	}
 
-	public CpsObject getSelectedCpsObject() {
+	public AbstractCpsObject getSelectedCpsObject() {
 		return selectedCpsObject;
 	}
 
-	public void setSelectedCpsObject(CpsObject selectedCpsObject) {
+	public void setSelectedCpsObject(AbstractCpsObject selectedCpsObject) {
 		this.selectedCpsObject = selectedCpsObject;
 	}
 
-	public ArrayList<CpsObject> getSelectedCpsObjects() {
+	public ArrayList<AbstractCpsObject> getSelectedCpsObjects() {
 		return selectedObjects;
 	}
 
@@ -362,7 +362,7 @@ public class Model {
 	 * @param Objects
 	 *            Array of Objects
 	 */
-	public void setClipboradObjects(ArrayList<CpsObject> c) {
+	public void setClipboradObjects(ArrayList<AbstractCpsObject> c) {
 		this.clipboardObjects = c;
 	}
 
@@ -370,7 +370,7 @@ public class Model {
 	 * 
 	 * @return Objects in the Clipboard
 	 */
-	public ArrayList<CpsObject> getClipboradObjects() {
+	public ArrayList<AbstractCpsObject> getClipboradObjects() {
 		return clipboardObjects;
 	}
 

+ 6 - 3
src/ui/model/idCounter.java

@@ -3,12 +3,11 @@ package ui.model;
 public class idCounter {
 	private static int counter = 1;
 
-
 	public static synchronized int nextId() {
 		return counter++;
 
 	}
-	
+
 	/**
 	 * @return the counter
 	 */
@@ -17,10 +16,14 @@ public class idCounter {
 	}
 
 	/**
-	 * @param counter the counter to set
+	 * @param counter
+	 *            the counter to set
 	 */
 	public static void setCounter(int counter) {
 		idCounter.counter = counter;
 	}
 
+	public static void resetCounter() {
+		counter = 1;
+	}
 }

+ 7 - 3
src/ui/model/idCounterElem.java

@@ -3,12 +3,11 @@ package ui.model;
 public class idCounterElem {
 	private static int counter = 1;
 
-
 	public static synchronized int nextId() {
 		return counter++;
 
 	}
-	
+
 	/**
 	 * @return the counter
 	 */
@@ -17,10 +16,15 @@ public class idCounterElem {
 	}
 
 	/**
-	 * @param counter the counter to set
+	 * @param counter
+	 *            the counter to set
 	 */
 	public static void setCounter(int counter) {
 		idCounterElem.counter = counter;
 	}
 
+	public static void resetCounter() {
+		counter = 1;
+	}
+
 }

+ 3 - 3
src/ui/view/AddElementPopUp.java

@@ -18,7 +18,7 @@ import javax.swing.JComboBox;
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.ImageIcon;
 
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import ui.model.Model;
@@ -35,7 +35,7 @@ public class AddElementPopUp extends JDialog {
 	private JTextField providedEnergy;
 	private JTextField amount;
 	private HolonElement hl;
-	private CpsObject tempCps;
+	private AbstractCpsObject tempCps;
 
 	/**
 	 * Launch the application.
@@ -173,7 +173,7 @@ public class AddElementPopUp extends JDialog {
 
 	}
 
-	public void setActualCps(CpsObject cps) {
+	public void setActualCps(AbstractCpsObject cps) {
 		this.tempCps = cps;
 	}
 

+ 3 - 3
src/ui/view/AddObjectPopUp.java

@@ -35,7 +35,7 @@ import javax.swing.SwingConstants;
 import javax.swing.border.EmptyBorder;
 import javax.swing.filechooser.FileNameExtensionFilter;
 
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import ui.controller.Control;
@@ -56,7 +56,7 @@ public class AddObjectPopUp extends JDialog {
 	private String filePath = " ";
 	private String givenCategory;
 	private JLabel lblImagePreview;
-	private CpsObject toEdit;
+	private AbstractCpsObject toEdit;
 	private boolean editState;
 	private boolean imageChanged = false;
 
@@ -76,7 +76,7 @@ public class AddObjectPopUp extends JDialog {
 	/**
 	 * Create the dialog.
 	 */
-	public AddObjectPopUp(boolean edit, CpsObject obj, String cat) {
+	public AddObjectPopUp(boolean edit, AbstractCpsObject obj, String cat) {
 		toEdit = obj;
 		editState = edit;
 		this.setIconImage(new ImageIcon(this.getClass().getResource("/Images/Dummy_House.png")).getImage()

+ 29 - 39
src/ui/view/GUI.java

@@ -63,13 +63,15 @@ import javax.swing.tree.TreeCellRenderer;
 import Interfaces.CategoryListener;
 import classes.Category;
 import classes.CpsEdge;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
 import classes.HolonTransformer;
 import ui.controller.Control;
-import ui.model.Model;;
+import ui.model.Model;
+import ui.model.idCounter;
+import ui.model.idCounterElem;;
 
 public class GUI<E> implements CategoryListener {
 
@@ -193,7 +195,7 @@ public class GUI<E> implements CategoryListener {
 	private boolean dragging = false;
 	private String actualObjectClicked;
 	private Image img = null;
-	private CpsObject tempCps = null;
+	private AbstractCpsObject tempCps = null;
 	private int yValueElements = 0;
 
 	private Console console = new Console();
@@ -213,7 +215,7 @@ public class GUI<E> implements CategoryListener {
 	// Coord for the Edit-Modus in the PropertieTable
 	private int yProThis;
 	private int xProThis;
-	private CpsObject temp = null;
+	private AbstractCpsObject temp = null;
 	private final JButton btnTest = new JButton("test");
 	private final JMenuItem mntmUndo = new JMenuItem("Undo");
 	private final JMenuItem mntmRedo = new JMenuItem("Redo");
@@ -254,24 +256,10 @@ public class GUI<E> implements CategoryListener {
 				if (JOptionPane.showConfirmDialog(frmCyberPhysical, "Are you sure you want to exit?",
 						"Cyber Physical Systems Model", JOptionPane.YES_NO_OPTION,
 						JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
-					deleteDirectory(new File(System.getProperty("user.home") + "/HolonGUI/Autosave"));
+					controller.deleteDirectory(new File(System.getProperty("user.home") + "/HolonGUI/Autosave"));
 					System.exit(0);
 				}
 			}
-
-			private void deleteDirectory(File path) {
-				if (path.exists()) {
-					File[] files = path.listFiles();
-					for (int i = 0; i < files.length; i++) {
-						if (files[i].isDirectory()) {
-							deleteDirectory(files[i]);
-						} else {
-							files[i].delete();
-						}
-					}
-					path.delete();
-				}
-			}
 		});
 
 		JPanel contentPane = (JPanel) frmCyberPhysical.getContentPane();
@@ -295,7 +283,7 @@ public class GUI<E> implements CategoryListener {
 					controller.loadFile(controller.getUndoSave());
 					canvas.repaint();
 					ArrayList<HolonElement> tempList = new ArrayList<>();
-					for (CpsObject cps : model.getObjectsOnCanvas()) {
+					for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 						if (cps instanceof HolonObject) {
 							for (HolonElement h : ((HolonObject) cps).getElements()) {
 								tempList.add(h);
@@ -332,7 +320,7 @@ public class GUI<E> implements CategoryListener {
 					controller.loadFile(controller.getRedoSave());
 					canvas.repaint();
 					ArrayList<HolonElement> tempList = new ArrayList<>();
-					for (CpsObject cps : model.getObjectsOnCanvas()) {
+					for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 						if (cps instanceof HolonObject) {
 							for (HolonElement h : ((HolonObject) cps).getElements()) {
 								tempList.add(h);
@@ -365,7 +353,7 @@ public class GUI<E> implements CategoryListener {
 			@Override
 			public void actionPerformed(ActionEvent e) {
 				model.getSelectedCpsObjects().clear();
-				for (CpsObject cps : model.getObjectsOnCanvas()) {
+				for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 					controller.addSelectedObject(cps);
 				}
 				canvas.repaint();
@@ -382,7 +370,7 @@ public class GUI<E> implements CategoryListener {
 
 			@Override
 			public void actionPerformed(ActionEvent e) {
-				for (CpsObject cps : model.getSelectedCpsObjects()) {
+				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
 					controller.delCanvasObject(cps);
 				}
 				model.getSelectedCpsObjects().clear();
@@ -648,7 +636,7 @@ public class GUI<E> implements CategoryListener {
 		btnAddHolEL.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent arg0) {
 				if (model.getSelectedCpsObjects().size() == 1) {
-					CpsObject tempCpsObject = getActualCps();
+					AbstractCpsObject tempCpsObject = getActualCps();
 					if (tempCpsObject != null && tempCpsObject.getClass() == HolonObject.class
 							&& tempCpsObject.getID() != 0) {
 						addElementPopUp = new AddElementPopUp();
@@ -948,7 +936,7 @@ public class GUI<E> implements CategoryListener {
 				Image imgR = null;
 				if (leaf) {
 					for (Category cat : model.getCategories()) {
-						for (CpsObject cps : cat.getObjects()) {
+						for (AbstractCpsObject cps : cat.getObjects()) {
 							if (value.toString().compareTo(cps.getObjName()) == 0) {
 								File checkPath = new File(cps.getImage());
 								if (checkPath.exists()) {
@@ -991,7 +979,7 @@ public class GUI<E> implements CategoryListener {
 					if (dragging) {
 						int x = (int) canvas.getMousePosition().getX();
 						int y = (int) canvas.getMousePosition().getY();
-						CpsObject h = null;
+						AbstractCpsObject h = null;
 						if (tempCps.getClass() == HolonObject.class) {
 							h = new HolonObject(tempCps);
 						}
@@ -1041,7 +1029,7 @@ public class GUI<E> implements CategoryListener {
 					}
 					if (SwingUtilities.isRightMouseButton(e)) {
 						for (Category cat : model.getCategories()) {
-							for (CpsObject cps : cat.getObjects()) {
+							for (AbstractCpsObject cps : cat.getObjects()) {
 								if (actualObjectClicked.compareTo(cps.getObjName()) == 0
 										&& !(cps instanceof HolonSwitch)) {
 									editItem.setEnabled(true);
@@ -1053,7 +1041,7 @@ public class GUI<E> implements CategoryListener {
 						}
 					} else {
 						for (Category cat : model.getCategories()) {
-							for (CpsObject cps : cat.getObjects()) {
+							for (AbstractCpsObject cps : cat.getObjects()) {
 								if (actualObjectClicked.compareTo(cps.getObjName()) == 0) {
 									File checkPath = new File(cps.getImage());
 									if (checkPath.exists()) {
@@ -1118,7 +1106,7 @@ public class GUI<E> implements CategoryListener {
 									"Please select a Category first before adding " + selectedOption + ".");
 						}
 						if (selectedNode.getLevel() == 1) {
-							CpsObject tmp = new HolonObject("");
+							AbstractCpsObject tmp = new HolonObject("");
 							addObjectPopUP = new AddObjectPopUp(false, tmp, null);
 							addObjectPopUP.setVisible(true);
 							addObjectPopUP.setController(controller);
@@ -1351,6 +1339,8 @@ public class GUI<E> implements CategoryListener {
 				canvas.tempCps = null;
 				canvas.objectSelectionHighlighting();
 				canvas.repaint();
+				idCounter.resetCounter();
+				idCounterElem.resetCounter();
 			}
 		});
 
@@ -1374,7 +1364,7 @@ public class GUI<E> implements CategoryListener {
 						controller.loadFile(file.getAbsolutePath());
 						canvas.repaint();
 						ArrayList<HolonElement> tempList = new ArrayList<>();
-						for (CpsObject cps : model.getObjectsOnCanvas()) {
+						for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 							if (cps instanceof HolonObject) {
 								for (HolonElement h : ((HolonObject) cps).getElements()) {
 									tempList.add(h);
@@ -1439,7 +1429,7 @@ public class GUI<E> implements CategoryListener {
 					controller.loadFile(controller.getUndoSave());
 					canvas.repaint();
 					ArrayList<HolonElement> tempList = new ArrayList<>();
-					for (CpsObject cps : model.getObjectsOnCanvas()) {
+					for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 						if (cps instanceof HolonObject) {
 							for (HolonElement h : ((HolonObject) cps).getElements()) {
 								tempList.add(h);
@@ -1475,7 +1465,7 @@ public class GUI<E> implements CategoryListener {
 					controller.loadFile(controller.getRedoSave());
 					canvas.repaint();
 					ArrayList<HolonElement> tempList = new ArrayList<>();
-					for (CpsObject cps : model.getObjectsOnCanvas()) {
+					for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 						if (cps instanceof HolonObject) {
 							for (HolonElement h : ((HolonObject) cps).getElements()) {
 								tempList.add(h);
@@ -1591,7 +1581,7 @@ public class GUI<E> implements CategoryListener {
 					node_1 = new DefaultMutableTreeNode(c.getName());
 
 					// kann eventuell umgeändert werden
-					for (CpsObject obj : c.getObjects()) {
+					for (AbstractCpsObject obj : c.getObjects()) {
 						node_1.add(new DefaultMutableTreeNode(obj.getObjName()));
 					}
 					add(node_1);
@@ -1623,9 +1613,9 @@ public class GUI<E> implements CategoryListener {
 	 * 
 	 * @return selected CpsObject
 	 */
-	private CpsObject getActualCps() {
+	private AbstractCpsObject getActualCps() {
 		int tempID = model.getSelectedObjectID();
-		CpsObject tempCps = controller.searchByID(tempID);
+		AbstractCpsObject tempCps = controller.searchByID(tempID);
 		return tempCps;
 	}
 
@@ -1748,9 +1738,9 @@ public class GUI<E> implements CategoryListener {
 	 * @param elements
 	 *            ArrayList to be displayed
 	 */
-	private void fillElementTable(ArrayList<CpsObject> objects) {
+	private void fillElementTable(ArrayList<AbstractCpsObject> objects) {
 		if (objects.size() > 1) {
-			for (CpsObject o : objects) {
+			for (AbstractCpsObject o : objects) {
 				if (o instanceof HolonObject) {
 					for (HolonElement he : ((HolonObject) o).getElements()) {
 						Object[] temp = { o.getName() + ", " + o.getID(), he.getId(), he.getEleName(), he.getEnergy(),
@@ -1760,7 +1750,7 @@ public class GUI<E> implements CategoryListener {
 				}
 			}
 		} else if (objects.size() == 1) {
-			CpsObject o = objects.get(0);
+			AbstractCpsObject o = objects.get(0);
 			if (o instanceof HolonObject) {
 				for (HolonElement he : ((HolonObject) o).getElements()) {
 					Object[] temp = { he.getId(), he.getEleName(), he.getEnergy(), he.getAmount(), he.getActive() };
@@ -1775,7 +1765,7 @@ public class GUI<E> implements CategoryListener {
 	 */
 	private void refreshTableProperties() {
 		if (model.getSelectedCpsObjects().size() == 1) {
-			CpsObject tempCps = getActualCps();
+			AbstractCpsObject tempCps = getActualCps();
 			if (tempCps != null && tempCps.getClass() == HolonObject.class) {
 				tableModelProperties.removeRow(2);
 				Object[] tempEnergy = { "Total Energy", ((HolonObject) tempCps).getCurrentEnergy() };

+ 13 - 14
src/ui/view/MyCanvas.java

@@ -27,7 +27,7 @@ import javax.swing.JToolTip;
 
 import classes.CpsEdge;
 import classes.CpsNode;
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
@@ -51,7 +51,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 	private float scalediv20;
 
 	ArrayList<HolonElement> dataSelected = new ArrayList<HolonElement>();
-	ArrayList<CpsObject> TempSelected = new ArrayList<CpsObject>();
+	ArrayList<AbstractCpsObject> TempSelected = new ArrayList<AbstractCpsObject>();
 
 	private boolean[] showedInformation = new boolean[3];
 	private boolean dragging = false; // for dragging
@@ -59,7 +59,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 	private boolean drawEdge = false; // for drawing edges
 	private boolean click = false; // for double click
 	private boolean doMark = false; // for double click
-	public CpsObject tempCps = null;
+	public AbstractCpsObject tempCps = null;
 	private Rectangle selectRect = new Rectangle();
 	private CpsEdge edgeHighlight = null;
 
@@ -102,7 +102,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			@Override
 			public void actionPerformed(ActionEvent e) {
 				// Remove the selected Object objects
-				for (CpsObject cps : model.getSelectedCpsObjects()) {
+				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
 					controller.delCanvasObject(cps);
 				}
 				model.getSelectedCpsObjects().clear();
@@ -254,7 +254,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		}
 
 		// Objects
-		for (CpsObject cps : model.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			// Border Highlighting
 			g2.setColor(cps.getBorderColor());
 			if (g2.getColor() != Color.WHITE) {
@@ -348,7 +348,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		edgeHighlight = null;
 		controller.setSelecteEdge(null);
 		// Object Selection
-		for (CpsObject cps : model.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			cx = cps.getPosition().x;
 			cy = cps.getPosition().y;
 			if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy) {
@@ -424,7 +424,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 
 		if (doMark) {
 			doMark = false;
-			for (CpsObject cps : TempSelected) {
+			for (AbstractCpsObject cps : TempSelected) {
 				if (!model.getSelectedCpsObjects().contains(cps)) {
 					controller.addSelectedObject(cps);
 				}
@@ -482,7 +482,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				objectTT.setLocation(x, y + controller.getScale());
 
 				// All Selected Objects
-				for (CpsObject cps : model.getSelectedCpsObjects()) {
+				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
 					if (cps != tempCps) {
 						x = (int) (cps.getPosition().x + xDist);
 						y = (int) (cps.getPosition().y + yDist);
@@ -509,7 +509,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		// Mark Objects
 		if (doMark) {
 			TempSelected.clear();
-			for (CpsObject cps : model.getObjectsOnCanvas()) {
+			for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 				int x1 = sx, x2 = x, y1 = sy, y2 = y;
 
 				if (sx >= x) {
@@ -539,7 +539,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		y = e.getY();
 		// Everytghing for the tooltip :)
 		boolean on = false;
-		for (CpsObject cps : model.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 
 			cx = cps.getPosition().x;
 			cy = cps.getPosition().y;
@@ -582,9 +582,9 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		boolean onEdge = true;
 		boolean deleteNode = false;
 		CpsEdge e = null;
-		CpsObject tempCPS = null;
+		AbstractCpsObject tempCPS = null;
 
-		for (CpsObject cps : model.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			cx = cps.getPosition().x;
 			cy = cps.getPosition().y;
 			if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy
@@ -629,7 +629,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				n.setPosition(x - model.getScaleDiv2(), y - model.getScaleDiv2());
 				controller.addObjectCanvas(n);
 
-				CpsObject r, k;
+				AbstractCpsObject r, k;
 				r = p.getA();
 				k = p.getB();
 
@@ -656,7 +656,6 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			e = new CpsEdge(n, tempCps, edgeCapacity);
 
 			controller.AddEdgeOnCanvas(e);
-			// System.out.println("node ID: " + n.getID());
 		}
 
 		// Wenn ein Node ohne Connections da ist

+ 1 - 1
src/ui/view/SimulationMenu.java

@@ -16,7 +16,7 @@ import javax.swing.event.ChangeListener;
 
 import com.sun.crypto.provider.JceKeyStore;
 
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 import classes.HolonObject;
 import classes.HolonSwitch;
 import classes.HolonTransformer;

+ 7 - 7
src/ui/view/searchPopUp.java

@@ -6,7 +6,7 @@ import javax.swing.JDialog;
 import javax.swing.JPanel;
 import javax.swing.border.EmptyBorder;
 
-import classes.CpsObject;
+import classes.AbstractCpsObject;
 
 import javax.swing.JLabel;
 
@@ -109,7 +109,7 @@ public class searchPopUp extends JDialog {
 		btnFind.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent e) {
 				if (rdbtnAll.isSelected()) {
-					for (CpsObject cps : controller.getModel().getObjectsOnCanvas()) {
+					for (AbstractCpsObject cps : controller.getModel().getObjectsOnCanvas()) {
 
 						if (cps.getName().equals(findTextField.getText())
 								&& !controller.getModel().getSelectedCpsObjects().contains(cps)) {
@@ -165,13 +165,13 @@ public class searchPopUp extends JDialog {
 				canvas.TempSelected = new ArrayList<>();
 				controller.getModel().getSelectedCpsObjects().clear();
 
-				for (CpsObject cps : controller.getModel().getObjectsOnCanvas()) {
+				for (AbstractCpsObject cps : controller.getModel().getObjectsOnCanvas()) {
 					if (cps.getName().equals(findTextField.getText())
 							&& !controller.getModel().getSelectedCpsObjects().contains(cps))
 						selectObj(cps);
 				}
 
-				for (CpsObject cps : controller.getModel().getSelectedCpsObjects()) {
+				for (AbstractCpsObject cps : controller.getModel().getSelectedCpsObjects()) {
 					renameObj(cps, replaceTextField.getText());
 				}
 
@@ -207,7 +207,7 @@ public class searchPopUp extends JDialog {
 	 * 
 	 * @param obj
 	 */
-	public void selectObj(CpsObject obj) {
+	public void selectObj(AbstractCpsObject obj) {
 		controller.getModel().getSelectedCpsObjects().add(obj);
 	}
 
@@ -216,7 +216,7 @@ public class searchPopUp extends JDialog {
 	 * @param obj
 	 * @param name
 	 */
-	public void renameObj(CpsObject obj, String name) {
+	public void renameObj(AbstractCpsObject obj, String name) {
 		obj.setName(name);
 	}
 
@@ -225,7 +225,7 @@ public class searchPopUp extends JDialog {
 	 * @param idx
 	 * @return
 	 */
-	public CpsObject getObj(int idx) {
+	public AbstractCpsObject getObj(int idx) {
 		return controller.getModel().getObjectsOnCanvas().get(idx);
 	}