Forráskód Böngészése

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/ui/view/AddObjectPopUp.java
Edgardo Palza 8 éve
szülő
commit
3497646a78
34 módosított fájl, 795 hozzáadás és 309 törlés
  1. 1 1
      .checkstyle
  2. 5 5
      src/API/CpsAPI.java
  3. 2 2
      src/classes/AbstractCpsObject.java
  4. 2 2
      src/classes/CpsNode.java
  5. 39 35
      src/classes/HolonElement.java
  6. 50 44
      src/classes/HolonObject.java
  7. 34 41
      src/classes/HolonSwitch.java
  8. 26 13
      src/classes/HolonTransformer.java
  9. 3 3
      src/classes/Position.java
  10. 27 3
      src/classes/SubNet.java
  11. 14 13
      src/tests/praktikumHolonsAdapter.java
  12. 11 5
      src/tests/praktikumHolonsTestAutoSaveController.java
  13. 32 20
      src/tests/praktikumHolonsTestCanvasController.java
  14. 21 0
      src/tests/praktikumHolonsTestCategoryController.java
  15. 65 0
      src/tests/praktikumHolonsTestClasses.java
  16. 44 0
      src/tests/praktikumHolonsTestGlobalController.java
  17. 47 5
      src/tests/praktikumHolonsTestLoadAndStoreController.java
  18. 0 5
      src/tests/praktikumHolonsTestMultiPurposeController.java
  19. 12 2
      src/tests/praktikumHolonsTestObjectController.java
  20. 0 5
      src/tests/praktikumHolonsTestStressAnalysis.java
  21. 7 3
      src/tests/praktikumHolonsTestSuite.java
  22. 2 2
      src/ui/controller/LoadController.java
  23. 14 14
      src/ui/controller/SimulationManager.java
  24. 3 3
      src/ui/controller/StoreController.java
  25. 18 3
      src/ui/model/IdCounter.java
  26. 20 2
      src/ui/model/IdCounterElem.java
  27. 136 38
      src/ui/model/Model.java
  28. 14 4
      src/ui/view/AboutUsPopUp.java
  29. 22 7
      src/ui/view/AddElementPopUp.java
  30. 74 10
      src/ui/view/AddObjectPopUp.java
  31. 5 2
      src/ui/view/CategoryPanel.java
  32. 13 8
      src/ui/view/Console.java
  33. 21 4
      src/ui/view/DefaulTable.java
  34. 11 5
      src/ui/view/GUI.java

+ 1 - 1
.checkstyle

@@ -4,7 +4,7 @@
   <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="Checkstyle_BP" local="true">
+  <fileset name="all" enabled="true" check-config-name="BP Configuration" local="false">
     <file-match-pattern match-pattern="." include-pattern="true"/>
   </fileset>
 </fileset-config>

+ 5 - 5
src/API/CpsAPI.java

@@ -7,7 +7,7 @@ import classes.CpsEdge;
 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();
 	}
@@ -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;

+ 2 - 2
src/classes/AbstractCpsObject.java

@@ -2,7 +2,7 @@ package classes;
 
 import java.awt.Color;
 import java.util.ArrayList;
-import ui.model.idCounter;
+import ui.model.IdCounter;
 
 /**
  * The abstract class "CpsObject" represents any possible object in the system
@@ -62,7 +62,7 @@ public abstract class AbstractCpsObject {
 		setName(obj.getObjName());
 		setConnections(new ArrayList<CpsEdge>());
 		setPosition(new Position());
-		setID(idCounter.nextId());
+		setID(IdCounter.nextId());
 		setImage(obj.getImage());
 	}
 

+ 2 - 2
src/classes/CpsNode.java

@@ -2,7 +2,7 @@ package classes;
 
 import java.util.ArrayList;
 
-import ui.model.idCounter;
+import ui.model.IdCounter;
 
 /**
  * The class "CpsNode" represents empty Objects in the system. They are just
@@ -24,6 +24,6 @@ public class CpsNode extends AbstractCpsObject {
 		this.setConnections(new ArrayList<CpsEdge>());
 		this.setImage("/Images/node.png");
 		this.setSav("CVS");
-		this.setID(idCounter.nextId());
+		this.setID(IdCounter.nextId());
 	}
 }

+ 39 - 35
src/classes/HolonElement.java

@@ -2,11 +2,11 @@ package classes;
 
 import java.awt.Point;
 import java.util.LinkedList;
-import ui.model.idCounterElem;
+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
@@ -59,13 +59,14 @@ public class HolonElement {
 		setActive(true);
 		setSign(energy);
 		setEnergyAt(energy);
-		setId(idCounterElem.nextId());
+		setId(IdCounterElem.nextId());
 	}
 
 	/**
-	 * 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());
@@ -76,22 +77,22 @@ public class HolonElement {
 		setEnergyAt(element.getEnergy());
 		setSav("CVS");
 		setObj(element.getObj());
-		setId(idCounterElem.nextId());
+		setId(IdCounterElem.nextId());
 	}
 
 	/**
-	 * 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;

+ 50 - 44
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
@@ -24,7 +23,7 @@ public class HolonObject extends AbstractCpsObject {
 	/* 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,32 +35,19 @@ public class HolonObject extends AbstractCpsObject {
 	/**
 	 * 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
@@ -74,8 +60,8 @@ public class HolonObject extends AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 		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 AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 	}
 
 	/**
-	 * deletes Element at a given index
+	 * deletes Element at a given index.
 	 * 
 	 * @param idx
 	 *            index
@@ -165,7 +157,7 @@ public class HolonObject extends AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 	}
 
 	/**
+	 * 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 AbstractCpsObject {
 		}
 	}
 
+	/**
+	 * 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;
 	}

+ 34 - 41
src/classes/HolonSwitch.java

@@ -3,6 +3,12 @@ package classes;
 import java.awt.Point;
 import java.util.LinkedList;
 
+/**
+ * The class HolonSwitch represents a Switch, which can be turned on and off.
+ * 
+ * @author Gruppe14
+ *
+ */
 public class HolonSwitch extends AbstractCpsObject {
 
 	/**
@@ -40,31 +46,13 @@ public class HolonSwitch extends AbstractCpsObject {
 
 	/**
 	 * Create a new HolonSwitch with the default name ("Switch"), a default
-	 * value of automatic handle and active status
+	 * value of automatic handle and active status.
 	 * 
-	 * @param ObjName
+	 * @param objName
 	 *            String
 	 */
-	public HolonSwitch(String ObjName) {
-		super(ObjName);
-		setManualState(true);
-		setAutoState(true);
-		setActiveAt(true);
-		setManualMode(false);
-	}
-
-	/**
-	 * Create a new HolonSwitch with user-defined name, a default value of
-	 * automatic handle and active status
-	 * 
-	 * @param ObjName
-	 *            String
-	 * @param obj
-	 *            String
-	 */
-	public HolonSwitch(String ObjName, String obj) {
-		super(ObjName);
-		super.setName(obj);
+	public HolonSwitch(String objName) {
+		super(objName);
 		setManualState(true);
 		setAutoState(true);
 		setActiveAt(true);
@@ -75,6 +63,7 @@ public class HolonSwitch extends AbstractCpsObject {
 	 * Create a copy of an existing HolonSwitch.
 	 * 
 	 * @param obj
+	 *            the Object to copy
 	 */
 	public HolonSwitch(AbstractCpsObject obj) {
 		super(obj);
@@ -86,7 +75,7 @@ public class HolonSwitch extends AbstractCpsObject {
 	}
 
 	/**
-	 * Calculates the state of the Switch
+	 * Calculates the state of the Switch.
 	 */
 	public void switchState() {
 		if (manualMode) {
@@ -100,7 +89,7 @@ public class HolonSwitch extends AbstractCpsObject {
 	}
 
 	/**
-	 * Getter for the status of the Switch at a given timestep
+	 * Getter for the status of the Switch at a given timestep.
 	 * 
 	 * @param timeStep
 	 *            int
@@ -115,9 +104,9 @@ public class HolonSwitch extends AbstractCpsObject {
 	}
 
 	/**
-	 * Overall status of the switch (manual or automatic mode)
+	 * Overall status of the switch (manual or automatic mode).
 	 * 
-	 * @return
+	 * @return boolean the State
 	 */
 	public boolean getState() {
 		if (manualMode) {
@@ -129,9 +118,10 @@ public class HolonSwitch extends AbstractCpsObject {
 	}
 
 	/**
-	 * Change the state of the Switch to manual
+	 * Change the state of the Switch to manual.
 	 * 
 	 * @param state
+	 *            the State
 	 */
 	public void setManualState(boolean state) {
 		this.manualActive = state;
@@ -139,9 +129,10 @@ public class HolonSwitch extends AbstractCpsObject {
 	}
 
 	/**
-	 * Set the state of the Switch to automatic
+	 * Set the state of the Switch to automatic.
 	 * 
 	 * @param state
+	 *            the State
 	 */
 	public void setAutoState(boolean state) {
 		this.autoActive = state;
@@ -149,7 +140,7 @@ public class HolonSwitch extends AbstractCpsObject {
 	}
 
 	/**
-	 * Set Image of the Switch
+	 * Set Image of the Switch.
 	 */
 	private void setImage() {
 		if (manualMode) {
@@ -168,7 +159,7 @@ public class HolonSwitch extends AbstractCpsObject {
 	}
 
 	/**
-	 * For automatic use only (throught the graph)
+	 * For automatic use only (throught the graph).
 	 * 
 	 * @return the Graph Points
 	 */
@@ -177,9 +168,9 @@ public class HolonSwitch extends AbstractCpsObject {
 	}
 
 	/**
-	 * Set the values of the switch in the graph (auto. mode only)
+	 * Set the values of the switch in the graph (auto. mode only).
 	 * 
-	 * @param points,
+	 * @param points
 	 *            the Graph points
 	 */
 	public void setGraphPoints(LinkedList<Point> points) {
@@ -188,25 +179,27 @@ public class HolonSwitch extends AbstractCpsObject {
 
 	/**
 	 * All values of the graph for the selected Switch (only auto-Mode) get the
-	 * activeAt Array
+	 * activeAt Array.
+	 * 
+	 * @return boolean[] the States of each Iteration
 	 */
 	public boolean[] getActiveAt() {
 		return activeAt;
 	}
 
 	/**
-	 * Overall value of the Swtich (only manual-Mode)
+	 * Returns the ManualState.
 	 * 
-	 * @return
+	 * @return boolean Manual State
 	 */
 	public boolean getActiveManual() {
 		return this.manualActive;
 	}
 
 	/**
-	 * Set the value of the Switch
+	 * Set the value of the Switch.
 	 * 
-	 * @param active,
+	 * @param active
 	 *            the default value
 	 */
 	public void setActiveAt(boolean active) {
@@ -216,18 +209,18 @@ public class HolonSwitch extends AbstractCpsObject {
 	}
 
 	/**
-	 * Set the overall value of the Switch (manual mode)
+	 * Set the overall value of the Switch (manual mode).
 	 * 
-	 * @param mode
+	 * @param mode the mode (boolean)
 	 */
 	public void setManualMode(boolean mode) {
 		manualMode = mode;
 	}
 
 	/**
-	 * Get the value of the switch (manual mode)
+	 * Get manualmode state.
 	 * 
-	 * @return
+	 * @return boolean manual mode state
 	 */
 	public boolean getManualMode() {
 		return manualMode;

+ 26 - 13
src/classes/HolonTransformer.java

@@ -1,5 +1,11 @@
 package classes;
-
+/**
+ * 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 */
@@ -14,17 +20,19 @@ public class HolonTransformer extends AbstractCpsObject {
 
 	/**
 	 * 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, String obj) {
-		super(ObjName);
-		super.setName(obj);
+	public HolonTransformer(String objName) {
+		super(objName);
 	}
 
+	/**
+	 * Copy of the Object.
+	 * 
+	 * @param obj the Object to Copy
+	 */
 	public HolonTransformer(AbstractCpsObject obj) {
 		super(obj);
 		this.setTransformRatio(((HolonTransformer) obj).getTransformRatio());
@@ -32,7 +40,7 @@ public class HolonTransformer extends AbstractCpsObject {
 	}
 
 	/**
-	 * Set transform ratio
+	 * Set transform ratio.
 	 * 
 	 * @param ratio
 	 *            desired ratio
@@ -42,7 +50,7 @@ public class HolonTransformer extends AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 	}
 
 	/**
-	 * Set fixed Transform Value
+	 * Set fixed Transform Value.
 	 * 
 	 * @param fixed
 	 *            desired fixed Transform Value
@@ -61,7 +69,7 @@ public class HolonTransformer extends AbstractCpsObject {
 	}
 
 	/**
-	 * 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 AbstractCpsObject {
 		return this.transformFixed;
 	}
 
+	/**
+	 * Get the Output of the Transformer.
+	 * 
+	 * @return The Output
+	 */
 	public float getOutput() {
 		float output = 0;
 		return output;

+ 3 - 3
src/classes/Position.java

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

+ 27 - 3
src/classes/subNet.java → src/classes/SubNet.java

@@ -8,25 +8,49 @@ import java.util.ArrayList;
  * @author Gruppe14
  *
  */
-public class subNet {
+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) {
+	/**
+	 * 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;
 	}

+ 14 - 13
src/tests/praktikumHolonsAdapter.java

@@ -6,6 +6,7 @@ import java.util.Iterator;
 import static java.lang.Math.*;
 
 import classes.Category;
+import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 
@@ -18,39 +19,39 @@ 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 = 0; i < 18279; i++) {
+		for (int i = 1; i < 18279; i++) {
 			arr.add(new Category(generate(i)));
 		}
 	}
 	
 	/**
-	 * 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<HolonObject> arr) {
-		for (int i = 0; i < 18279; i++) {
+	public void generateObjects(ArrayList<AbstractCpsObject> arr) {
+		for (int i = 1; i < 18279; i++) {
 			arr.add(new HolonObject(generate(i)));
 		}
 	}
 	
 	/**
-	 * 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 = 0; i < 18279; i++) {
+		for (int i = 1; i < 18279; i++) {
 			arr.add(new HolonElement(generate(i), 1, 10));
 		}
 	}
 	
 	/**
-	 * 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))];

+ 11 - 5
src/tests/praktikumHolonsTestAutoSaveController.java

@@ -11,7 +11,7 @@ import ui.controller.MultiPurposeController;
 import ui.controller.ObjectController;
 import ui.controller.StoreController;
 import ui.model.Model;
-import ui.model.idCounter;
+import ui.model.IdCounter;
 
 public class praktikumHolonsTestAutoSaveController {
 	protected praktikumHolonsAdapter adapter;
@@ -22,9 +22,12 @@ public class praktikumHolonsTestAutoSaveController {
 	protected ObjectController obj;
 	protected StoreController storeController;
 	protected LoadController loadController;
-	protected idCounter id;
+	protected IdCounter id;
 	protected String path = System.getProperty("user.home") + "/HolonGUI/Test/";
 
+	/**
+	 * Setup for the test.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -40,8 +43,11 @@ public class praktikumHolonsTestAutoSaveController {
 		File file = new File(path);
 		file.mkdirs();
 	}
-	
-	public void autoSaveMinimal(){
-		
+
+	/**
+	 *  kommentar hier hin.
+	 */
+	public void autoSaveMinimal() {
+
 	}
 }

+ 32 - 20
src/tests/praktikumHolonsTestCanvasController.java

@@ -1,19 +1,19 @@
 package tests;
 
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import classes.CpsEdge;
 import classes.AbstractCpsObject;
+import classes.CpsEdge;
 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 ui.model.IdCounter;
+
+import org.junit.Test;
+import org.junit.Before;
+import static org.junit.Assert.assertTrue;
 
 public class praktikumHolonsTestCanvasController {
 
@@ -23,6 +23,9 @@ public class praktikumHolonsTestCanvasController {
 	protected CategoryController cg;
 	protected CanvasController controller;
 
+	/**
+	 * Setup for the tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -30,12 +33,15 @@ public class praktikumHolonsTestCanvasController {
 		mp = new MultiPurposeController(model);
 		cg = new CategoryController(model, mp);
 		controller = new CanvasController(model, mp);
-		idCounter.setCounter(1);
+		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
+			// 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() {
 

+ 65 - 0
src/tests/praktikumHolonsTestClasses.java

@@ -1,8 +1,73 @@
 package tests;
 
 import classes.*;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import org.junit.Before;
+import org.junit.Test;
 
 public class praktikumHolonsTestClasses {
 
+	@Test
+	public void testCategory() {
+		Category test1 = new Category("Test1");
+		Category test2 = new Category("Test2");
+		HolonObject obj1 = new HolonObject("Test Object");
+		ArrayList<AbstractCpsObject> arr = new ArrayList<>();
+
+		
+		assertTrue("Name not correct", test1.getName().equals("Test1"));
+		assertTrue("Name not correct", test2.getName().equals("Test2"));
+		assertTrue("Name should not be the same", !test1.getName().equals(test2.getName()));
+		assertTrue("Should be empty", test1.getObjects().size() == 0);
+		test1.getObjects().add(obj1);
+		assertTrue("Should not be empty", test1.getObjects().size() == 1);
+		assertTrue("Should be empty", test2.getObjects().size() == 0);
+		test1.setObjects(arr);
+		assertTrue("Should be empty", test1.getObjects().size() == 0);
+		arr.add(obj1);
+		test2.setObjects(arr);
+		arr = new ArrayList<>();
+		assertTrue("Shoud be empty", arr.isEmpty());
+		arr = test2.getObjects();
+		assertTrue("Shoud not be empty", !arr.isEmpty());
+	}
+	
+	@Test
+	public void testHolonObject() {
+		
+		HolonObject test1 = new HolonObject("Test1");
+		HolonObject test2 = new HolonObject("Test2");
+		HolonObject test3 = new HolonObject(test1);
+		HolonElement ele = new HolonElement("Element", 1, 10);
+		
+		ArrayList<HolonElement> arr = new ArrayList<>();
+		
+		assertTrue("Should be Empty", test1.getElements().isEmpty());
+		test1.setElements(arr);
+		assertTrue("Should be Empty", test1.getElements().isEmpty());
+		arr.add(ele);
+		arr.add(ele);
+		assertTrue("Should be Empty", test2.getElements().isEmpty());
+		assertTrue("Current Energy not corrent", test2.getCurrentEnergy() == 0);
+		test2.setElements(arr);
+		assertTrue("Should not be Empty", !test2.getElements().isEmpty());
+		assertTrue("Current Energy not corrent", test2.getCurrentEnergy() == 20);
+		assertTrue("Current Energy not corrent", test2.getCurrentEnergyAtTimeStep(20) == 20);
+		String str = test2.toStringElements();
+		assertTrue("String not corrent", str.equals("Element, Element"));
+		test2.deleteElement(0);
+		assertTrue("Current Energy not corrent", test2.getCurrentEnergy() == 10);
+		
+		assertTrue("Should be Empty", test3.getElements().isEmpty());
+		test3.setElements(test2.copyElements(test2.getElements()));
+		assertTrue("Should be Empty", !test3.getElements().isEmpty());
+		assertTrue("Should be state 0", test3.getState() == 0);
+		test3.setState(1);
+		
+	}
+	
 	
 }

+ 44 - 0
src/tests/praktikumHolonsTestGlobalController.java

@@ -1,5 +1,49 @@
 package tests;
 
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import ui.controller.GlobalController;
+import ui.model.Model;
+
 public class praktikumHolonsTestGlobalController {
 
+	protected Model model;
+	protected GlobalController controller;
+
+	
+	@Before
+	public void setUp() {
+		model = new Model();
+		controller = new GlobalController(model);
+
+	}
+	
+	@Test
+	public void testGlobalControls() {
+		int prevScale = controller.getScale();
+		int prevScaleDiv2 = controller.getScaleDiv2();
+		int prevNumberSav = controller.getNumbersOfSaves();
+		boolean sim = model.getIsSimulation();
+		int timer = model.getTimerSpeed();
+		int it = model.getCurIteration();
+		
+		controller.setScale(100);
+		controller.setNumberOfSaves(50);
+		controller.setIsSimulation(true);
+		controller.setTimerSpeed(2000);
+		controller.setCurIteration(10);
+		
+		assertTrue("Scale was not changed", controller.getScale() != prevScale);
+		assertTrue("ScaleDiv2 was not changed ", model.getScaleDiv2() != prevScaleDiv2);
+		assertTrue("Number of Saves was not changed", controller.getNumbersOfSaves() != prevNumberSav);
+		assertTrue("Simulation State was not Set", sim != model.getIsSimulation());
+		assertTrue("Timer speed was not changed", timer != model.getTimerSpeed());
+		assertTrue("Curr Iteration was not Set", it != model.getCurIteration());
+		
+	}
+
 }

+ 47 - 5
src/tests/praktikumHolonsTestLoadAndStoreController.java

@@ -2,20 +2,27 @@ package tests;
 
 import java.awt.Point;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.LinkedList;
 
 import org.junit.Before;
 import org.junit.Test;
+import java.lang.Error;
 
 import com.sun.security.auth.UnixNumericGroupPrincipal;
 
 import classes.Category;
 import classes.CpsEdge;
+
+import classes.CpsNode;
+
 import classes.AbstractCpsObject;
+
 import classes.HolonElement;
 import classes.HolonObject;
+import classes.HolonSwitch;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -28,7 +35,7 @@ import ui.controller.MultiPurposeController;
 import ui.controller.ObjectController;
 import ui.controller.StoreController;
 import ui.model.Model;
-import ui.model.idCounter;
+import ui.model.IdCounter;
 import ui.view.UnitGraph;
 
 public class praktikumHolonsTestLoadAndStoreController {
@@ -41,9 +48,12 @@ public class praktikumHolonsTestLoadAndStoreController {
 	protected ObjectController obj;
 	protected StoreController storeController;
 	protected LoadController loadController;
-	protected idCounter id;
+	protected IdCounter id;
 	protected String path = System.getProperty("user.home") + "/HolonGUI/Test/";
 
+	/**
+	 * Setup for the Tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -60,6 +70,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		file.mkdirs();
 	}
 
+	/**
+	 * minimal tests for saving.
+	 */
 	@Test
 	public void testStoreMinimal() {
 		try {
@@ -83,6 +96,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 
+	/**
+	 * basic tests for saving.
+	 */
 	@Test
 	public void testStoreBasic() {
 
@@ -106,6 +122,10 @@ public class praktikumHolonsTestLoadAndStoreController {
 					&& model.getObjectsOnCanvas().get(i - 1).getObjName().equals("House"));
 		}
 
+		HolonSwitch sw = new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch"));
+		sw.setPosition(77, 88);
+		cvs.addNewObject(sw);
+
 		try {
 			File sav = new File(path + "TestSavBasic.json");
 			storeController.writeSaveFile(sav.getAbsolutePath());
@@ -123,6 +143,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 
+	/**
+	 * advanced tests for saving.
+	 */
 	@Test
 	public void testStoreAdvanced() {
 
@@ -146,6 +169,7 @@ public class praktikumHolonsTestLoadAndStoreController {
 			}
 		}
 
+
 		try {
 			File sav = new File(path + "TestSavAdvanced.json");
 			storeController.writeSaveFile(sav.getAbsolutePath());
@@ -158,6 +182,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 
 	}
 
+	/**
+	 * minimal tests for loading a save file.
+	 */
 	@Test
 	public void testLoadMinimal() {
 		try {
@@ -193,6 +220,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 	
+	/**
+	 * basic tests for loading a save file.
+	 */
 	@Test
 	public void testLoadBasic() {
 		assertTrue("Non-Existant Category Exists", mp.searchCat("J") == null);
@@ -207,9 +237,11 @@ 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");
+
 			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);
+
 			}
 			
 			assertTrue("NUmber of Categories not match", model.getCategories().size() == 3);
@@ -235,6 +267,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 	
+	/**
+	 * advanced tests for loading a save file.
+	 */
 	@Test
 	public void testLoadAdvanced() {
 		
@@ -242,22 +277,29 @@ public class praktikumHolonsTestLoadAndStoreController {
 			assertTrue("Objects on Canvas is not 0", model.getObjectsOnCanvas().size() == 0);
 			assertTrue("Save File was not found", new File(path + "TestSavAdvanced.json").exists());
 			loadController.readJSON(path + "TestSavAdvanced.json");
-			assertTrue("Objects on Canvas is not 0", model.getObjectsOnCanvas().size() == 100);
+			assertTrue("Objects on Canvas is not 100", model.getObjectsOnCanvas().size() == 100);
 			
 			int n = model.getObjectsOnCanvas().size();
 			assertTrue("Number of Edges does not Match", model.getEdgesOnCanvas().size() == (n * (n - 1)) / 2);
 			assertTrue("Element has no UnitGraph", !mp.searchEle((HolonObject)model.getObjectsOnCanvas().get(77), "Fridge").getGraphPoints().isEmpty());
 			assertTrue("Points in UnitGraph does not Match", mp.searchEle((HolonObject)model.getObjectsOnCanvas().get(77), "Fridge").getGraphPoints().size() == 3);
-
+			
 		} catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
 	}
+	
+	@Test (expected=FileNotFoundException.class)
+	public void testLoadException() throws IOException {
+		assertTrue("Save File was not found", !new File(path + "TestSavDummy.json").exists());
+		loadController.readJSON(path + "TestSavDummy.json");
+	}
 
 	/**
+	 * 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<>();

+ 0 - 5
src/tests/praktikumHolonsTestMultiPurposeController.java

@@ -1,5 +0,0 @@
-package tests;
-
-public class praktikumHolonsTestMultiPurposeController {
-
-}

+ 12 - 2
src/tests/praktikumHolonsTestObjectController.java

@@ -1,7 +1,5 @@
 package tests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Before;
@@ -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,6 +96,9 @@ 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++) {

+ 0 - 5
src/tests/praktikumHolonsTestStressAnalysis.java

@@ -1,5 +0,0 @@
-package tests;
-
-public class praktikumHolonsTestStressAnalysis {
-
-}

+ 7 - 3
src/tests/praktikumHolonsTestSuite.java

@@ -7,16 +7,20 @@ 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));
 		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestCanvasController.class));
 		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestObjectController.class));
 		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestLoadAndStoreController.class));
-//		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestMultiPurposeController.class));
-//		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestGlobalController.class));
+		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestGlobalController.class));
 //		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestAutoSaveController.class));
+		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestClasses.class));
 		return suite;
 	}
 }

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

@@ -22,7 +22,7 @@ import classes.HolonObject;
 import classes.HolonSwitch;
 import classes.HolonTransformer;
 import ui.model.Model;
-import ui.model.idCounter;
+import ui.model.IdCounter;
 
 public class LoadController {
 
@@ -83,7 +83,7 @@ public class LoadController {
 			if (key.equals("CG"))
 				readCategory((JSONArray) json.get(key));
 			else if (key.equals("ID"))
-				idCounter.setCounter(Integer.parseInt(json.get(key.toString()).toString()));
+				IdCounter.setCounter(Integer.parseInt(json.get(key.toString()).toString()));
 			else if (key.toString().contains("CGO") || key.toString().contains("CVSO"))
 				obj.add(key.toString());
 			else if (key.toString().contains("CGE") || key.toString().contains("CVSE"))

+ 14 - 14
src/ui/controller/SimulationManager.java

@@ -9,7 +9,7 @@ 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;
 
@@ -17,7 +17,7 @@ public class SimulationManager {
 	private Model model;
 	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;
@@ -26,7 +26,7 @@ public class SimulationManager {
 	public SimulationManager(Model m) {
 		canvas = null;
 		model = m;
-		subNets = new ArrayList<subNet>();
+		subNets = new ArrayList<SubNet>();
 		simMode = model.getIsSimulation();
 	}
 
@@ -39,10 +39,10 @@ public class SimulationManager {
 		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);
@@ -79,7 +79,7 @@ public class SimulationManager {
 		canvas.repaint();
 	}
 
-	public void setFlow(subNet sN, boolean simulation) {
+	public void setFlow(SubNet sN, boolean simulation) {
 		if (simulation) {
 			setFlowSimulation(sN);
 		} else {
@@ -87,7 +87,7 @@ public class SimulationManager {
 		}
 	}
 
-	public void setFlowModelation(subNet sN) {
+	public void setFlowModelation(SubNet sN) {
 		for (HolonObject hl : sN.getObjects()) {
 			float energy = hl.getCurrentEnergyAtTimeStep(timeStep);
 			if (energy > 0) {
@@ -99,7 +99,7 @@ public class SimulationManager {
 		}
 	}
 
-	public void setFlowSimulation(subNet sN) {
+	public void setFlowSimulation(SubNet sN) {
 		ArrayList<AbstractCpsObject> producers = new ArrayList<AbstractCpsObject>();
 		AbstractCpsObject tmp = null;
 		tagTable = new HashMap<Integer, Float>();
@@ -244,7 +244,7 @@ public class SimulationManager {
 	 * @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")) {
@@ -266,7 +266,7 @@ public class SimulationManager {
 		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()) {
@@ -287,14 +287,14 @@ public class SimulationManager {
 	 * generates all subNets from all objectsToHandle
 	 */
 	public void searchForSubNets() {
-		subNets = new ArrayList<subNet>();
+		subNets = new ArrayList<SubNet>();
 		boolean end = false;
 		int i = 0;
 		AbstractCpsObject cps;
 		if (objectsToHandle.size() > 0) {
 			while (!end) {
 				cps = objectsToHandle.get(i);
-				subNet singleSubNet = new subNet(new ArrayList<HolonObject>(), new ArrayList<CpsEdge>(),
+				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) {
@@ -316,7 +316,7 @@ public class SimulationManager {
 	 * @param sN
 	 * @return
 	 */
-	public subNet buildSubNet(AbstractCpsObject cps, ArrayList<Integer> visited, subNet sN) {
+	public SubNet buildSubNet(AbstractCpsObject cps, ArrayList<Integer> visited, SubNet sN) {
 		visited.add(cps.getID());
 		if (cps instanceof HolonObject) {
 			sN.getObjects().add((HolonObject) cps);
@@ -430,7 +430,7 @@ public class SimulationManager {
 		copyObjects(model.getObjectsOnCanvas());
 	}
 
-	public ArrayList<subNet> getSubNets() {
+	public ArrayList<SubNet> getSubNets() {
 		return subNets;
 	}
 

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

@@ -16,7 +16,7 @@ import classes.HolonObject;
 import classes.HolonSwitch;
 import classes.HolonTransformer;
 import ui.model.Model;
-import ui.model.idCounter;
+import ui.model.IdCounter;
 
 public class StoreController {
 
@@ -38,7 +38,7 @@ public class StoreController {
 		JSONObject json = new JSONObject();
 
 		json.put("MODE", "ALL");
-		json.put("ID", idCounter.getCounter());
+		json.put("ID", IdCounter.getCounter());
 		writeCategory(json);
 		writeCategoryObjects(json);
 		writeCanvasObjects(json);
@@ -60,7 +60,7 @@ public class StoreController {
 		JSONObject json = new JSONObject();
 		
 		json.put("MODE", "CANVAS");
-		json.put("ID", idCounter.getCounter());
+		json.put("ID", IdCounter.getCounter());
 		writeCanvasObjects(json);
 		writeCanvasElements(json);
 		writeEdges(json);

+ 18 - 3
src/ui/model/idCounterElem.java → src/ui/model/IdCounter.java

@@ -1,14 +1,25 @@
 package ui.model;
 
-public class idCounterElem {
+/**
+ * ID-Counter for all Cps Objects.
+ * 
+ * @author Gruppe14
+ */
+public class IdCounter {
 	private static int counter = 1;
 
+	/**
+	 * Return the next ID and increment the ID counter by 1.
+	 * @return the next ID
+	 */
 	public static synchronized int nextId() {
 		return counter++;
 
 	}
 
 	/**
+	 * Return the Counter.
+	 * 
 	 * @return the counter
 	 */
 	public static int getCounter() {
@@ -16,15 +27,19 @@ public class idCounterElem {
 	}
 
 	/**
+	 * Set the Counter.
+	 * 
 	 * @param counter
 	 *            the counter to set
 	 */
 	public static void setCounter(int counter) {
-		idCounterElem.counter = counter;
+		IdCounter.counter = counter;
 	}
 
+	/**
+	 * Reset the Counter.
+	 */
 	public static void resetCounter() {
 		counter = 1;
 	}
-
 }

+ 20 - 2
src/ui/model/idCounter.java → src/ui/model/IdCounterElem.java

@@ -1,14 +1,26 @@
 package ui.model;
 
-public class idCounter {
+/**
+ * ID-Counter for all Holon Elements.
+ * 
+ * @author Gruppe14
+ */
+public class IdCounterElem {
 	private static int counter = 1;
 
+	/**
+	 * Return the next ID and increment the ID counter by 1.
+	 * 
+	 * @return the next ID
+	 */
 	public static synchronized int nextId() {
 		return counter++;
 
 	}
 
 	/**
+	 * Return the Counter.
+	 * 
 	 * @return the counter
 	 */
 	public static int getCounter() {
@@ -16,14 +28,20 @@ public class idCounter {
 	}
 
 	/**
+	 * Set the Counter.
+	 * 
 	 * @param counter
 	 *            the counter to set
 	 */
 	public static void setCounter(int counter) {
-		idCounter.counter = counter;
+		IdCounterElem.counter = counter;
 	}
 
+	/**
+	 * Reset the Counter.
+	 */
 	public static void resetCounter() {
 		counter = 1;
 	}
+
 }

+ 136 - 38
src/ui/model/Model.java

@@ -12,16 +12,22 @@ import classes.Category;
 import classes.CpsEdge;
 import classes.AbstractCpsObject;
 import classes.HolonElement;
-import ui.controller.*;
 import ui.view.Console;
 
+/**
+ * The Class Model is the class where everything is saved. All changes made to
+ * the Data is managed via a controller.
+ * 
+ * @author Gruppe14
+ *
+ */
 public class Model {
 
 	// Global Variables
-	private static int SCALE = 50; // Picture Scale
-	private static int SCALE_DIV2 = SCALE / 2;
+	private static int sCALE = 50; // Picture Scale
+	private static int sCALEdIV2 = sCALE / 2;
 	private static final int ITERATIONS = 100;
-	private int CUR_ITERATION = 0;
+	private int curIteration = 0;
 	// ID of the Selected Object
 	private AbstractCpsObject selectedCpsObject = null;
 	private HolonElement selectedHolonElement;
@@ -41,9 +47,6 @@ public class Model {
 	private int autoSaveNr = -1;
 	// number of max simultaneous autosaves
 	private int numberOfSaves = 35;
-	// eventuell wenn Canvasgröße gewählt werden kann
-	private int HEIGHT;
-	private int WIDTH;
 	/*
 	 * Array of all categories in the model. It is set by default with the
 	 * categories ENERGY, BUILDINGS and COMPONENTS
@@ -71,7 +74,7 @@ public class Model {
 	private List<CategoryListener> categoryListeners;
 	private List<ObjectListener> objectListeners;
 
-	/*
+	/**
 	 * Constructor for the model. It initializes the categories and
 	 * objectsOnCanvas by default values. Listeners are also initialized by
 	 * default values.
@@ -88,6 +91,8 @@ public class Model {
 	}
 
 	/**
+	 * Returns all Categories.
+	 * 
 	 * @return the categories
 	 */
 	public ArrayList<Category> getCategories() {
@@ -95,6 +100,8 @@ public class Model {
 	}
 
 	/**
+	 * Sets all Categories.
+	 * 
 	 * @param categories
 	 *            the categories to set
 	 */
@@ -104,7 +111,7 @@ public class Model {
 
 	/**
 	 * Transform the Arraylist of categories into a string of all objectName
-	 * with a separation (',') between each name
+	 * with a separation (',') between each name.
 	 * 
 	 * @return String of all names separeted by ','
 	 */
@@ -121,6 +128,8 @@ public class Model {
 	}
 
 	/**
+	 * Returns all Objects on the Canvas.
+	 * 
 	 * @return the objectsOnCanvas
 	 */
 	public ArrayList<AbstractCpsObject> getObjectsOnCanvas() {
@@ -128,6 +137,8 @@ public class Model {
 	}
 
 	/**
+	 * Sets all Objects on the Canvas.
+	 * 
 	 * @param objectsOnCanvas
 	 *            the objectsOnCanvas to set
 	 */
@@ -136,6 +147,8 @@ public class Model {
 	}
 
 	/**
+	 * Get all Edges on the Canvas.
+	 * 
 	 * @return the objectsOnCanvas
 	 */
 	public ArrayList<CpsEdge> getEdgesOnCanvas() {
@@ -143,15 +156,19 @@ public class Model {
 	}
 
 	/**
-	 * @param objectsOnCanvas
-	 *            the objectsOnCanvas to set
+	 * Adds an Edge to The Canvas.
+	 * 
+	 * @param edge
+	 *            the edgesOnCanvas to add
 	 */
 	public void addEdgeOnCanvas(CpsEdge edge) {
 		this.edgesOnCanvas.add(edge);
 	}
 
 	/**
-	 * @param edgesOnCanvas
+	 * Remove an edge from the Canvas.
+	 * 
+	 * @param edge
 	 *            the edge to remove
 	 */
 	public void removeEdgesOnCanvas(CpsEdge edge) {
@@ -159,7 +176,9 @@ public class Model {
 	}
 
 	/**
-	 * @param EdgesOnCanvas
+	 * Sets the edges on the Canvas.
+	 * 
+	 * @param arrayList
 	 *            the edgesOnCanvas to set
 	 */
 	public void setEdgesOnCanvas(ArrayList<CpsEdge> arrayList) {
@@ -167,6 +186,8 @@ public class Model {
 	}
 
 	/**
+	 * Returns the ObjectListener.
+	 * 
 	 * @return the objectListeners
 	 */
 	public List<ObjectListener> getObjectListeners() {
@@ -174,6 +195,8 @@ public class Model {
 	}
 
 	/**
+	 * Sets the ObjectListener.
+	 * 
 	 * @param linkedList
 	 *            the objectListeners to set
 	 */
@@ -182,6 +205,8 @@ public class Model {
 	}
 
 	/**
+	 * Returns the CategorieListener.
+	 * 
 	 * @return the categoryListeners
 	 */
 	public List<CategoryListener> getCategoryListeners() {
@@ -189,6 +214,8 @@ public class Model {
 	}
 
 	/**
+	 * Sets the CategorieListener.
+	 * 
 	 * @param linkedList
 	 *            the categoryListeners to set
 	 */
@@ -197,9 +224,10 @@ public class Model {
 	}
 
 	/**
-	 * Set the ID of the selected Object 0 = no Object is selected
+	 * Set the ID of the selected Object 0 = no Object is selected.
 	 * 
-	 * @param ID
+	 * @param id
+	 *            the ID
 	 * 
 	 */
 	public void setSelectedObjectID(int id) {
@@ -207,7 +235,7 @@ public class Model {
 	}
 
 	/**
-	 * Returns the ID of the selected Object 0 = no Object is selected
+	 * Returns the ID of the selected Object 0 = no Object is selected.
 	 * 
 	 * @return ID
 	 */
@@ -215,51 +243,84 @@ public class Model {
 		return selectedID;
 	}
 
+	/**
+	 * Returns the Selected Cps Object.
+	 * 
+	 * @return selected Cps Object
+	 */
 	public AbstractCpsObject getSelectedCpsObject() {
 		return selectedCpsObject;
 	}
 
+	/**
+	 * Set the Selected Objecs.
+	 * 
+	 * @param selectedCpsObject
+	 *            Objects that are selected
+	 */
 	public void setSelectedCpsObject(AbstractCpsObject selectedCpsObject) {
 		this.selectedCpsObject = selectedCpsObject;
 	}
 
+	/**
+	 * Returns all selected Objects on the Canvas.
+	 * 
+	 * @return The selected Objects
+	 */
 	public ArrayList<AbstractCpsObject> getSelectedCpsObjects() {
 		return selectedObjects;
 	}
 
+	/**
+	 * Returns the Selected Holon Element.
+	 * 
+	 * @return selected Holon Element
+	 */
 	public HolonElement getSelectedHolonElement() {
 		return selectedHolonElement;
 	}
 
+	/**
+	 * Sets the Selecte HolonElement.
+	 * 
+	 * @param selectedHolonElement
+	 *            that is Selected
+	 */
 	public void setSelectedHolonElement(HolonElement selectedHolonElement) {
 		this.selectedHolonElement = selectedHolonElement;
 	}
 
 	/**
-	 * Returns SCALE
+	 * Returns the sCale (Scale for the Images).
 	 * 
-	 * @return SCALE
+	 * @return sCALE
 	 */
 	public int getScale() {
-		return SCALE;
+		return sCALE;
 	}
 
 	/**
-	 * Returns SCALE_DIV2
+	 * Returns sCALEdIV2 (The Scale divided by 2).
 	 * 
-	 * @return SCALE_DIV2
+	 * @return sCALEdIV2
 	 */
 	public int getScaleDiv2() {
-		return SCALE_DIV2;
+		return sCALEdIV2;
 	}
 
+	/**
+	 * Sets the Image Scale.
+	 * 
+	 * @param scale
+	 *            for the image
+	 */
 	public void setScale(int scale) {
-		SCALE = scale;
-		SCALE_DIV2 = SCALE / 2;
+		sCALE = scale;
+		sCALEdIV2 = sCALE / 2;
 	}
 
 	/**
-	 * Returns ITERATIONS
+	 * Returns ITERATIONS.
 	 * 
 	 * @return ITERATIONS
 	 */
@@ -268,28 +329,29 @@ public class Model {
 	}
 
 	/**
-	 * sets the current Iteration
+	 * sets the current Iteration.
 	 * 
-	 * @param cur_it,
+	 * @param curIT
 	 *            the current Iteration
 	 */
-	public void setCurIteration(int cur_it) {
-		this.CUR_ITERATION = cur_it;
+	public void setCurIteration(int curIT) {
+		this.curIteration = curIT;
 	}
 
 	/**
-	 * Returns CUR_ITERATIONS
+	 * Returns cURiTERATION.
 	 * 
-	 * @return CUR_ITERATIONS
+	 * @return cURiTERATION
 	 */
 	public int getCurIteration() {
-		return CUR_ITERATION;
+		return curIteration;
 	}
 
 	/**
-	 * Set the selected Edge
+	 * Set the selected Edge.
 	 * 
 	 * @param edge
+	 *            that is selected
 	 * 
 	 */
 	public void setSelectedEdge(CpsEdge edge) {
@@ -297,7 +359,7 @@ public class Model {
 	}
 
 	/**
-	 * Returns the selected Edge
+	 * Returns the selected Edge.
 	 * 
 	 * @return selectedEdge
 	 */
@@ -306,6 +368,8 @@ public class Model {
 	}
 
 	/**
+	 * Returns the Categorie Index.
+	 * 
 	 * @return the cgIdx
 	 */
 	public HashMap<String, Integer> getCgIdx() {
@@ -313,6 +377,8 @@ public class Model {
 	}
 
 	/**
+	 * Sets the Categorie Index.
+	 * 
 	 * @param cgIdx
 	 *            the cgIdx to set
 	 */
@@ -321,6 +387,8 @@ public class Model {
 	}
 
 	/**
+	 * Returns the CanvasObject Index.
+	 * 
 	 * @return the cvsObjIdx
 	 */
 	public HashMap<Integer, Integer> getCvsObjIdx() {
@@ -328,6 +396,8 @@ public class Model {
 	}
 
 	/**
+	 * Sets the CanvasObject Index.
+	 * 
 	 * @param cvsObjIdx
 	 *            the cvsObjIdx to set
 	 */
@@ -335,15 +405,28 @@ public class Model {
 		this.cvsObjIdx = cvsObjIdx;
 	}
 
+	/**
+	 * Sets the auto save Number.
+	 * 
+	 * @param autoSaveNr
+	 *            the auto save number
+	 */
 	public void setAutoSaveNr(int autoSaveNr) {
 		this.autoSaveNr = autoSaveNr;
 	}
 
+	/**
+	 * Returns the auto save Number.
+	 * 
+	 * @return the auto save Number
+	 */
 	public int getAutoSaveNr() {
 		return autoSaveNr;
 	}
 
 	/**
+	 * Returns the Number of Saves.
+	 * 
 	 * @return the numberOfSaves
 	 */
 	public int getNumberOfSaves() {
@@ -351,6 +434,8 @@ public class Model {
 	}
 
 	/**
+	 * Set the Number of Saves.
+	 * 
 	 * @param numberOfSaves
 	 *            the numberOfSaves to set
 	 */
@@ -359,7 +444,9 @@ public class Model {
 	}
 
 	/**
-	 * @param Objects
+	 * Sets the ClipboardObjects.
+	 * 
+	 * @param c
 	 *            Array of Objects
 	 */
 	public void setClipboradObjects(ArrayList<AbstractCpsObject> c) {
@@ -367,6 +454,7 @@ public class Model {
 	}
 
 	/**
+	 * Returns all Objects in the Clipboard.
 	 * 
 	 * @return Objects in the Clipboard
 	 */
@@ -375,6 +463,7 @@ public class Model {
 	}
 
 	/**
+	 * Sets the console.
 	 * 
 	 * @param console
 	 *            the console
@@ -384,6 +473,7 @@ public class Model {
 	}
 
 	/**
+	 * Returns the Console.
 	 * 
 	 * @return console the console
 	 */
@@ -392,7 +482,9 @@ public class Model {
 	}
 
 	/**
-	 * @param timerSpeed
+	 * Sets the Interval in ms between each Iteration.
+	 * 
+	 * @param t
 	 *            speed for the Iterations
 	 */
 	public void setTimerSpeed(int t) {
@@ -400,6 +492,8 @@ public class Model {
 	}
 
 	/**
+	 * get the Interval in ms between each Iteration.
+	 * 
 	 * @return timerSpeed speed for the Iterations
 	 */
 	public int getTimerSpeed() {
@@ -407,14 +501,18 @@ public class Model {
 	}
 
 	/**
+	 * Sets the Simulation state (true = simulation, false = modeling).
+	 * 
 	 * @param isSimulation
 	 *            boolean for for isSimulation
 	 */
-	public void setIsSimulation(boolean b) {
-		this.isSimulation = b;
+	public void setIsSimulation(boolean isSimulation) {
+		this.isSimulation = isSimulation;
 	}
 
 	/**
+	 * Returns the Simulation state (true = simulation, false = modeling).
+	 * 
 	 * @return isSimulation boolean for for isSimulation
 	 */
 	public boolean getIsSimulation() {

+ 14 - 4
src/ui/view/AboutUsPopUp.java

@@ -9,17 +9,27 @@ import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 
+/**
+ * AboutUs Pop Up Window.
+ * 
+ * @author Gruppe14
+ */
 public class AboutUsPopUp extends JFrame {
+	/**
+	 * Serial.
+	 */
+	private static final long serialVersionUID = 1L;
 	private final JPanel contentPanel = new JPanel();
 	private final JPanel contentPanel2 = new JPanel();
 	private final JPanel contentPanel3 = new JPanel();
 	private JLabel titel = new JLabel("Cyber Physical Systems");
 	private JLabel text = new JLabel("Something nice for the user :D");
-	private JLabel names_developers = new JLabel("K. Trometer, D. Rieder, T. Zheng, J. Widhalm and E. Palza");
-	private JLabel names_client = new JLabel("");
-	private JLabel name_leader = new JLabel("");
+	private JLabel namesDevelopers = new JLabel("K. Trometer, D. Rieder, T. Zheng, J. Widhalm and E. Palza");
 	private JLabel credits = new JLabel();
 
+	/**
+	 * Constructor.
+	 */
 	public AboutUsPopUp() {
 		super("About Us");
 		this.setIconImage(new ImageIcon(this.getClass().getResource("/Images/Dummy_House.png")).getImage()
@@ -35,7 +45,7 @@ public class AboutUsPopUp extends JFrame {
 		contentPanel2.add(text);
 		contentPanel2.add(credits);
 		getContentPane().add(contentPanel2, BorderLayout.CENTER);
-		contentPanel3.add(names_developers);
+		contentPanel3.add(namesDevelopers);
 		getContentPane().add(contentPanel3, BorderLayout.SOUTH);
 	}
 }

+ 22 - 7
src/ui/view/AddElementPopUp.java

@@ -4,8 +4,6 @@ import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.FlowLayout;
 import java.awt.Image;
-import java.util.ArrayList;
-
 import javax.swing.JButton;
 import javax.swing.JDialog;
 import javax.swing.JPanel;
@@ -14,22 +12,26 @@ import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
 import javax.swing.JTextField;
-import javax.swing.JComboBox;
-import javax.swing.DefaultComboBoxModel;
 import javax.swing.ImageIcon;
 
 import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
-import ui.model.Model;
-
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 import java.awt.event.KeyListener;
 import java.awt.event.ActionEvent;
-
+/**
+ * popup for adding an Holon Element to a holon Object.
+ * 
+ * @author Gruppe14
+ */
 public class AddElementPopUp extends JDialog {
 
+	/**
+	 * Serial.
+	 */
+	private static final long serialVersionUID = 1L;
 	private final JPanel contentPanel = new JPanel();
 	private JTextField elementName;
 	private JTextField providedEnergy;
@@ -39,6 +41,8 @@ public class AddElementPopUp extends JDialog {
 
 	/**
 	 * Launch the application.
+	 * 
+	 * @param args standard
 	 */
 	public static void main(String[] args) {
 		try {
@@ -132,6 +136,7 @@ public class AddElementPopUp extends JDialog {
 								float energy = Float.parseFloat(providedEnergy.getText().toString());
 								int elementAmount = Integer.parseInt(amount.getText().toString());
 								hl = new HolonElement(elementName.getText().toString(), elementAmount, energy);
+								
 								dispose();
 							} catch (NumberFormatException e) {
 								JOptionPane.showMessageDialog(new JFrame(),
@@ -172,10 +177,20 @@ public class AddElementPopUp extends JDialog {
 
 	}
 
+	/**
+	 * Sets the actual Cps.
+	 * 
+	 * @param cps actual Cps
+	 */
 	public void setActualCps(AbstractCpsObject cps) {
 		this.tempCps = cps;
 	}
 
+	/**
+	 * Returns the created Element.
+	 * 
+	 * @return the Element
+	 */
 	public HolonElement getElement() {
 		return hl;
 	}

+ 74 - 10
src/ui/view/AddObjectPopUp.java

@@ -40,8 +40,14 @@ import classes.HolonElement;
 import classes.HolonObject;
 import ui.controller.Control;
 
+/**
+ * Popup for adding a Holon Object to a Category.
+ * 
+ * @author Gruppe14
+ */
 public class AddObjectPopUp extends JDialog {
 
+	private static final long serialVersionUID = 1L;
 	private final JPanel contentPanel = new JPanel();
 	private AddElementPopUp addElement;
 	private JTextField objectName;
@@ -62,6 +68,9 @@ public class AddObjectPopUp extends JDialog {
 
 	/**
 	 * Launch the application.
+	 * 
+	 * @param args
+	 *            standard
 	 */
 	public static void main(String[] args) {
 		try {
@@ -75,6 +84,13 @@ public class AddObjectPopUp extends JDialog {
 
 	/**
 	 * Create the dialog.
+	 * 
+	 * @param edit
+	 *            true if edit
+	 * @param obj
+	 *            the object
+	 * @param cat
+	 *            the categorie
 	 */
 	public AddObjectPopUp(boolean edit, AbstractCpsObject obj, String cat) {
 		toEdit = obj;
@@ -183,9 +199,15 @@ public class AddObjectPopUp extends JDialog {
 					addElement.setActualCps(toEdit);
 					addElement.setVisible(true);
 					HolonElement hl = addElement.getElement();
+<<<<<<< HEAD
 					if (hl != null) {
 						addElement(hl);
 					}
+=======
+					hl.setSav(givenCategory);
+					hl.setObj(objectName.getText());
+					addElement(hl);
+>>>>>>> e31b286b827a2f60952b26ca6921853e95260ca5
 				}
 			});
 
@@ -199,11 +221,11 @@ public class AddObjectPopUp extends JDialog {
 			{
 
 				listModel = new DefaultListModel();
-				HolonElement hel = new HolonElement("Test", 100, 5);
-				String name = hel.getEleName();
+
 				/*
-				 * for (int i = 0; i < 11; i++) { hel.setEleName(name + i);
-				 * addElement(hel); }
+				 * HolonElement hel = new HolonElement("Test", 100, 5); String
+				 * name = hel.getEleName(); for (int i = 0; i < 11; i++) {
+				 * hel.setEleName(name + i); addElement(hel); }
 				 */
 				list = new JList(listModel);
 				scrollPane.setViewportView(list);
@@ -290,19 +312,28 @@ public class AddObjectPopUp extends JDialog {
 		}
 	}
 
+	/**
+	 * adds a Holon Element.
+	 * 
+	 * @param hl
+	 *            the HolonElement
+	 */
 	public void addElement(HolonElement hl) {
 		hElements.add(hl);
 		listModel.addElement(hl.getAmount() + "x: " + hl.getEleName() + " " + hl.getEnergy() + "U");
 	}
 
+	/**
+	 * Choose the file.
+	 */
 	protected void fileChooser() {
 		// TODO Auto-generated method stub
-		JFileChooser FileChooser = new JFileChooser();
+		JFileChooser fileChooser = new JFileChooser();
 		FileNameExtensionFilter filter = new FileNameExtensionFilter("png, jpg or jpeg", "png", "jpg", "jpeg");
-		FileChooser.setFileFilter(filter);
-		int returnValue = FileChooser.showOpenDialog(null);
+		fileChooser.setFileFilter(filter);
+		int returnValue = fileChooser.showOpenDialog(null);
 		if (returnValue == JFileChooser.APPROVE_OPTION) {
-			selectedFile = FileChooser.getSelectedFile();
+			selectedFile = fileChooser.getSelectedFile();
 			filePath = selectedFile.getAbsolutePath();
 			sourcePath.setText(filePath);
 			ImageIcon icon = new ImageIcon(
@@ -315,6 +346,9 @@ public class AddObjectPopUp extends JDialog {
 
 	}
 
+	/**
+	 * Copies the File.
+	 */
 	protected void copieFile() {
 		InputStream inStream = null;
 		OutputStream outStream = null;
@@ -339,15 +373,30 @@ public class AddObjectPopUp extends JDialog {
 			if (outStream != null)
 				outStream.close();
 			System.out.println("File Copied..");
-		} catch (IOException e1) {
-			e1.printStackTrace();
+		} catch (IOException eex) {
+			eex.printStackTrace();
 		}
 	}
 
+	/**
+	 * Edit the Information.
+	 * 
+	 * @param obj
+	 *            the CpsObject
+	 */
 	public void editInformation(HolonObject obj) {
 		objectName.setText(obj.getName());
 	}
 
+	/**
+	 * Get Jar Containing Folder.
+	 * 
+	 * @param aclass
+	 *            aClass
+	 * @return String
+	 * @throws Exception
+	 *             Exception
+	 */
 	public static String getJarContainingFolder(Class aclass) throws Exception {
 		CodeSource codeSource = aclass.getProtectionDomain().getCodeSource();
 
@@ -364,14 +413,29 @@ public class AddObjectPopUp extends JDialog {
 		return jarFile.getParentFile().getAbsolutePath();
 	}
 
+	/**
+	 * Return the Object.
+	 * 
+	 * @return the CpsObject
+	 */
 	public HolonObject getObject() {
 		return theObject;
 	}
 
+	/**
+	 * Sets the Controller.
+	 * 
+	 * @param controller the controller
+	 */
 	public void setController(Control controller) {
 		this.controller = controller;
 	}
 
+	/**
+	 * Set the Category.
+	 * 
+	 * @param cat the Category
+	 */
 	public void setCategory(String cat) {
 		givenCategory = cat;
 	}

+ 5 - 2
src/ui/view/CategoryPanel.java

@@ -1,7 +1,10 @@
 package ui.view;
-
+/**
+ * Here should be the Category Panel.
+ * 
+ * @author Gruppe14
+ */
 public class CategoryPanel {
 
 }
 
-//hier müsste das Panel eigentlich sein

+ 13 - 8
src/ui/view/Console.java

@@ -19,11 +19,14 @@ import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
 
+/**
+ * A Console is a Pane where text can be Printed on.
+ * 
+ * @author Gruppe14
+ * 
+ */
 public class Console extends JScrollPane {
 
-	/**
-	 * 
-	 */
 	private static final long serialVersionUID = 1L;
 	private final JTextPane consoleText = new JTextPane();
 	private final JPanel panel = new JPanel();
@@ -35,6 +38,9 @@ public class Console extends JScrollPane {
 	private JMenuItem itemCopy = new JMenuItem("Copy");
 	private JMenuItem itemClear = new JMenuItem("Clear Console");
 
+	/**
+	 * Constructor.
+	 */
 	public Console() {
 		super();
 		this.setBackground(Color.WHITE);
@@ -85,7 +91,7 @@ public class Console extends JScrollPane {
 	}
 
 	/**
-	 * Print Text on the console
+	 * Print Text on the console.
 	 *
 	 * @param text
 	 *            String the Text
@@ -97,10 +103,9 @@ public class Console extends JScrollPane {
 	 *            bold or not
 	 * @param italic
 	 *            italic or not
-	 * @param ln
+	 * @param nl
 	 *            new line or not
 	 * 
-	 * @return selected CpsObject
 	 */
 	public void addText(String text, Color color, int p, boolean bold, boolean italic, boolean nl) {
 		StyleConstants.setForeground(style, color);
@@ -118,7 +123,7 @@ public class Console extends JScrollPane {
 	}
 
 	/**
-	 * Print Text on the console in black and font size 12
+	 * Print Text on the console in black and font size 12.
 	 *
 	 * @param text
 	 *            String the Text
@@ -136,7 +141,7 @@ public class Console extends JScrollPane {
 	}
 
 	/**
-	 * Clears the console
+	 * Clears the console.
 	 */
 	public void clearConsole() {
 		consoleText.setText("");

+ 21 - 4
src/ui/view/DefaulTable.java

@@ -2,22 +2,39 @@ package ui.view;
 
 import javax.swing.table.DefaultTableModel;
 
+/**
+ * Default Table.
+ * 
+ * @author Gruppe14
+ */
 public class DefaulTable extends DefaultTableModel {
-	private boolean[][] editable_cells; // 2d array to represent rows and
+	private boolean[][] editableCells; // 2d array to represent rows and
 										// columns
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param rows the Rows
+	 * @param cols the Cols
+	 */
 	DefaulTable(int rows, int cols) { // constructor
 		super(rows, cols);
-		this.editable_cells = new boolean[rows][cols];
+		this.editableCells = new boolean[rows][cols];
 	}
 
 	@Override
 	public boolean isCellEditable(int row, int column) {
-		return this.editable_cells[row][column];
+		return this.editableCells[row][column];
 	}
 
+	/**
+	 * Set Cell Editable.
+	 * @param row the Rows
+	 * @param col the Cols
+	 * @param value true or false
+	 */
 	public void setCellEditable(int row, int col, boolean value) {
-		this.editable_cells[row][col] = value; // set cell true/false
+		this.editableCells[row][col] = value; // set cell true/false
 		this.fireTableCellUpdated(row, col);
 	}
 

+ 11 - 5
src/ui/view/GUI.java

@@ -70,9 +70,15 @@ import classes.HolonSwitch;
 import classes.HolonTransformer;
 import ui.controller.Control;
 import ui.model.Model;
-import ui.model.idCounter;
-import ui.model.idCounterElem;;
-
+import ui.model.IdCounter;
+import ui.model.IdCounterElem;;
+
+/**
+ * Graphical User Interface.
+ * @author Gruppe14
+ * 
+ * @param <E> Generic
+ */
 public class GUI<E> implements CategoryListener {
 
 	private JFrame frmCyberPhysical;
@@ -1339,8 +1345,8 @@ public class GUI<E> implements CategoryListener {
 				canvas.tempCps = null;
 				canvas.objectSelectionHighlighting();
 				canvas.repaint();
-				idCounter.resetCounter();
-				idCounterElem.resetCounter();
+				IdCounter.resetCounter();
+				IdCounterElem.resetCounter();
 			}
 		});