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

Jessey Widhalm 8 years ago
parent
commit
620fe2a6d4

+ 0 - 10
src/classes/AbstractCpsObject.java

@@ -248,16 +248,6 @@ public abstract class AbstractCpsObject {
 		this.borderColor = c;
 	}
 
-	/**
-	 * Set the Color of the edges.
-	 * 
-	 * @param color
-	 *            the Color to set
-	 */
-	public void setConnections(Color color) {
-		this.borderColor = color;
-	}
-
 	/**
 	 * For internal purpose (energy flow).
 	 * 

+ 0 - 21
src/classes/HolonElement.java

@@ -22,8 +22,6 @@ public class HolonElement {
 	private boolean active;
 	/* Total Energy */
 	private float totalEnergy;
-	/* Path of the image for the Obj. */
-	private String image;
 	/* +: for Consumers and -: Producers */
 	private char sign;
 	/* Place where the Object is Stored */
@@ -188,25 +186,6 @@ public class HolonElement {
 		this.active = active;
 	}
 
-	/**
-	 * Get Image path.
-	 * 
-	 * @return the image
-	 */
-	public String getImage() {
-		return image;
-	}
-
-	/**
-	 * Set Image path.
-	 * 
-	 * @param image
-	 *            the image to set
-	 */
-	public void setImage(String image) {
-		this.image = image;
-	}
-
 	/**
 	 * Multiply the amount of gadgets, given by the user, and the
 	 * consumption/production. If the switch isWorking is turned off for on

+ 0 - 53
src/tests/PraktikumHolonsTestAutoSaveControlle.java

@@ -1,53 +0,0 @@
-package tests;
-
-import java.io.File;
-
-import org.junit.Before;
-
-import classes.IdCounter;
-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;
-
-public class PraktikumHolonsTestAutoSaveControlle {
-	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() {
-
-	}
-}

+ 46 - 0
src/tests/PraktikumHolonsTestAutoSaveController.java

@@ -0,0 +1,46 @@
+package tests;
+
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import ui.controller.AutoSaveController;
+import ui.model.Model;
+
+public class PraktikumHolonsTestAutoSaveController {
+	protected Model model;
+	protected AutoSaveController controller;
+
+
+	/**
+	 * Setup for the test.
+	 */
+	@Before
+	public void setUp() {
+		model = new Model();
+		controller = new AutoSaveController(model);
+	}
+
+	/**
+	 *  kommentar hier hin.
+	 */
+	@Test
+	public void testAutoSave() {
+		int temp = controller.getAutoSaveNr();
+		assertTrue("AutoSave Number not forrect", temp == -1);
+		controller.increaseAutoSaveNr();
+		assertTrue("AutoSave Number not forrect", controller.getAutoSaveNr() == 0);
+		
+		for (int i = 0; i < 20; i++) {
+			controller.increaseAutoSaveNr();
+		}
+		
+		assertTrue("Is Allowed not set", controller.allowed());
+		
+		for (int i = 0; i < 20; i++) {
+			controller.decreaseAutoSaveNr();;
+		}
+		
+		
+	}
+}

+ 45 - 1
src/tests/PraktikumHolonsTestCanvasController.java

@@ -14,6 +14,8 @@ import org.junit.Test;
 import org.junit.Before;
 import static org.junit.Assert.assertTrue;
 
+import java.awt.Point;
+
 public class PraktikumHolonsTestCanvasController {
 
 	protected PraktikumHolonsAdapter adapter;
@@ -126,7 +128,7 @@ public class PraktikumHolonsTestCanvasController {
 
 			// 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
+			// 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);
@@ -155,4 +157,46 @@ public class PraktikumHolonsTestCanvasController {
 		assertTrue("Edge-M-R was not deleted", mp.searchEdge(13, 19) == null);
 		assertTrue("Edge-M-S was not deleted", mp.searchEdge(13, 20) == null);
 	}
+	
+	/**
+	 * Test copying Objects.
+	 */
+	@Test
+	public void testCutCopyPasteObjects() {
+		HolonObject a = new HolonObject("A");
+		HolonObject b = new HolonObject("B"); 
+		HolonObject c = new HolonObject("C"); 
+		
+		a = new HolonObject(a);
+		a.setPosition(1, 1);
+		b = new HolonObject(b);
+		b.setPosition(2, 2);
+		c = new HolonObject(c);
+		c.setPosition(3, 3);
+		CpsEdge edge1 = new CpsEdge(a, b);
+		CpsEdge edge2 = new CpsEdge(b, c);
+		CpsEdge edge3 = new CpsEdge(c, a);
+		controller.addNewObject(a);
+		controller.addEdgeOnCanvas(edge1);
+		controller.addEdgeOnCanvas(edge2);
+		controller.addEdgeOnCanvas(edge3);
+
+		
+		assertTrue("Clipboard not empty", model.getClipboradObjects().isEmpty());
+		model.getSelectedCpsObjects().add(a);
+		model.getSelectedCpsObjects().add(b);
+		model.getSelectedCpsObjects().add(c);
+		controller.copyObjects();
+		assertTrue("Clipboard empty", !model.getClipboradObjects().isEmpty());
+	
+		assertTrue("Clipboard empty", !model.getClipboradObjects().isEmpty());
+		
+		controller.pasteObjects(new Point(1, 1));
+		
+		controller.addNewObject(a);
+		controller.addNewObject(b);
+		controller.addNewObject(c);
+		controller.cutObjects();
+		
+	}
 }

+ 104 - 5
src/tests/PraktikumHolonsTestClasses.java

@@ -78,7 +78,6 @@ public class PraktikumHolonsTestClasses {
 		test1.setElements(new ArrayList<HolonElement>());
 		assertTrue("Not Empty", !test1.checkIfPartiallySupplied(1));
 		test3.addElements(new HolonElement("Element2", 1, -10));
-
 		assertTrue("Not Partially Supplied", test3.checkIfPartiallySupplied(1));
 		test3.addElements(new HolonElement("Element2", 2, -10));
 		assertTrue("Not Partially Supplied", test3.checkIfPartiallySupplied(1));
@@ -87,13 +86,23 @@ public class PraktikumHolonsTestClasses {
 		Color color = test3.getColor();
 		test3.setColor(new Color(0, 255, 255));
 		assertTrue(color.getBlue() != test3.getColor().getBlue());
+
+		test3.addElements(new HolonElement("Element3", 3, 50));
+		test3.setState();
+		assertTrue("Should be state 3", test3.getState() == 3);
+		test1.setState();
+		assertTrue("Should be state 0", test1.getState() == 0);
+		test2.setState();
+		
+		test2.setBorderColor(color);
+		assertTrue("Color not Same", color == test2.getBorderColor());
 	}
 
 	@Test
 	public void testHolonSwitch() {
 		HolonSwitch test1 = new HolonSwitch("Test1");
 		HolonSwitch test2 = new HolonSwitch(test1);
-		
+
 		assertTrue("Manuel Mode is on", !test2.getManualMode());
 		test2.switchState();
 		assertTrue(test2.getState());
@@ -113,7 +122,7 @@ public class PraktikumHolonsTestClasses {
 		test2.setGraphPoints(test1.getGraphPoints());
 		assertTrue(test1.getGraphPoints() == test2.getGraphPoints());
 	}
-	
+
 	@Test
 	public void testCpsEdge() {
 		CpsNode node1 = new CpsNode("Node1");
@@ -121,11 +130,101 @@ public class PraktikumHolonsTestClasses {
 		CpsNode node3 = new CpsNode("Node3");
 		CpsEdge edge1 = new CpsEdge(node1, node2, 100);
 		CpsEdge edge2 = new CpsEdge(node2, node3);
-		
+
+		assertTrue("Flow not 0", edge1.getFlow() == 0);
+		edge1.setFlow(50);
+		assertTrue("Capacity not right", edge1.getCapacity() == 100);
+		edge2.setFlow(50);
+		edge1.setCapacity(200);
+		assertTrue("Flow was not changed", edge1.getFlow() == 50);
+		assertTrue("Capacity not right", edge1.getCapacity() == 200);
+		assertTrue("line broken", edge2.getState());
+		edge2.calculateState(false);
+		assertTrue("line broken", edge2.getState());
+		edge2.setFlow(200);
+		edge2.calculateState(false);
+		assertTrue("line not broken", !edge2.getState());
+		edge1.setCapacity(-1);
+		edge1.calculateState(false);
+		edge1.setCapacity(500);
+		edge1.calculateState(true);
+		node1 = (CpsNode) edge1.getB();
+		node2 = (CpsNode) edge2.getA();
+		assertTrue("Not Same", node1 == node2);
+		assertTrue("State not right", edge1.getState());
+		edge1.setState(false);
+		assertTrue("State not right", !edge1.getState());
+		edge2.setTags(new ArrayList<>());
+		edge1.setTags(new ArrayList<>());
+		assertTrue("Tags not Empty", edge2.getTags().isEmpty());
+		edge2.addTag(1);
+		assertTrue("Tags not Empty", edge1.getTags().isEmpty());
+		assertTrue("Tags Empty", !edge2.getTags().isEmpty());
+		edge1.setTags(edge2.getTags());
+		assertTrue("Tags Empty", !edge1.getTags().isEmpty());
 	}
-	
+
 	@Test
 	public void testHolonElement() {
+		HolonElement ele1 = new HolonElement("TV", 2, -20);
+		HolonElement ele2 = new HolonElement("Fridge", 1, -50);
+		HolonElement ele3 = new HolonElement(ele2);
+
+		assertTrue("Array not empty", ele1.getEnergyAt()[0] == -20);
+		assertTrue("Array not empty", ele1.getEnergyAt()[2] == -20);
+		ele1.setEnergyAt(2, -10);
+		assertTrue("Array not empty", ele1.getEnergyAt()[2] == -10);
+		assertTrue("Name not correct", ele1.getEleName().equals("TV"));
+		ele1.setEleName(ele2.getEleName());
+		assertTrue("Name not correct", ele1.getEleName().equals("Fridge"));
+		assertTrue("Amount not correct", ele2.getAmount() == 1);
+		ele2.setAmount(5);
+		assertTrue("Amount not correct", ele2.getAmount() == 5);
+		assertTrue("Total Energy not Correct", ele2.getTotalEnergy() == ele2.getAmount() * ele2.getEnergy());
+		assertTrue("Sign not correct", ele2.getSign() == '-');
+		ele3.setSav("CVS");
+		assertTrue("SAV not correct", ele3.getSav().equals("CVS"));
+	}
+
+	@Test
+	public void testPosition() {
+		Position pos1 = new Position(100, 200);
+		Position pos2 = new Position();
+
+		assertTrue("Wront coordinates", pos1.x == 100 && pos1.y == 200);
+		assertTrue("Are the Same", pos1.x != pos2.x);
+		assertTrue("not (-1,-1)", pos2.x == -1 && pos2.y == -1);
+	}
+
+	@Test
+	public void testSubNet() {
+		PraktikumHolonsAdapter adapter = new PraktikumHolonsAdapter();
+
+		ArrayList<HolonObject> obj = new ArrayList<>();
+		ArrayList<CpsEdge> edge = new ArrayList<>();
+		ArrayList<HolonSwitch> sw = new ArrayList<>();
+
+		assertTrue("Not Empty", obj.isEmpty());
+		assertTrue("Not Empty", sw.isEmpty());
+		assertTrue("Not Empty", edge.isEmpty());
+
+		for (int i = 1; i < 10; i++) {
+			HolonObject o = new HolonObject(adapter.generate(i));
+			HolonSwitch s = new HolonSwitch(adapter.generate(i));
+			o = new HolonObject(o);
+			s = new HolonSwitch(s);
+			obj.add(o);
+			sw.add(s);
+			edge.add(new CpsEdge(o, s));
+		}
+		
+		SubNet sub = new SubNet(obj, edge, sw);
+
+		assertTrue("Empty", !sub.getObjects().isEmpty() && sub.getObjects().size() == 9);
+		assertTrue("Empty", !sub.getSwitches().isEmpty() && sub.getSwitches().size() == 9);
+		assertTrue("Empty", !sub.getEdges().isEmpty() && sub.getEdges().size() == 9);
+		assertTrue("Wrong Obj", sub.getObjects().get(5).getObjName().equals("F"));
+		
 		
 	}
 

+ 33 - 0
src/tests/PraktikumHolonsTestConsoleController.java

@@ -0,0 +1,33 @@
+package tests;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import ui.controller.ConsoleController;
+import ui.model.Model;
+import ui.view.Console;
+
+import static org.junit.Assert.*;
+
+import java.awt.Color;
+
+public class PraktikumHolonsTestConsoleController {
+
+	protected Model model;
+	protected ConsoleController controller;
+
+	@Before
+	public void setUp() {
+		model = new Model();
+		model.setConsole(new Console());
+		controller = new ConsoleController(model);
+	}
+
+	@Test
+	public void testConsoleController() {
+		controller.addTextToConsole("Hello World");
+		controller.addTextToConsole("Hello World2!", new Color(255, 255, 255), 11, false, true, false);
+		controller.clearConsole();
+
+	}
+}

+ 25 - 22
src/tests/PraktikumHolonsTestLoadAndStoreController.java

@@ -169,7 +169,6 @@ public class PraktikumHolonsTestLoadAndStoreController {
 			}
 		}
 
-
 		try {
 			File sav = new File(path + "TestSavAdvanced.json");
 			storeController.writeSaveFile(sav.getAbsolutePath());
@@ -188,27 +187,28 @@ public class PraktikumHolonsTestLoadAndStoreController {
 	@Test
 	public void testLoadMinimal() {
 		try {
-			//Category Tests
+			// Category Tests
 			Category building = mp.searchCat("Building");
 			assertTrue("Number of Categories does not match", model.getCategories().size() == 3);
 			assertTrue("TestFile was not found", new File(path + "TestCategoryMinimal.json").exists());
 			loadController.readJSON(path + "TestCategoryMinimal.json");
 			assertTrue("Number of Categories does not match", model.getCategories().size() == 3);
-			//Tests if its same instance and if Name is the same
+			// Tests if its same instance and if Name is the same
 			assertTrue("Same instance of Category:Building", building != mp.searchCat("Building")
 					&& building.getName().equals(mp.searchCat("Building").getName()));
-			
-			//Canvas Tests.. basically nothing happens because nothing is on the Canvas
+
+			// Canvas Tests.. basically nothing happens because nothing is on
+			// the Canvas
 			assertTrue("Number of Objects on Canvas does not match", model.getObjectsOnCanvas().size() == 0);
 			assertTrue("TestFile was not found", new File(path + "TestCanvasMinimal.json").exists());
 			loadController.readJSON(path + "TestCanvasMinimal.json");
 			assertTrue("Number of Objects on Canvas does not match", model.getObjectsOnCanvas().size() == 0);
-			
-			//Save File tests basically both Test from Above Combined
+
+			// Save File tests basically both Test from Above Combined
 			building = mp.searchCat("Building");
 			assertTrue("Number of Objects in Energy does not Match", mp.searchCat("Energy").getObjects().size() == 1);
 			assertTrue("TestFile was not found", new File(path + "TestSavMinimal.json").exists());
-			loadController.readJSON( path + "TestSavMinimal.json");
+			loadController.readJSON(path + "TestSavMinimal.json");
 			assertTrue("Number of Objects in Energy does not Match", mp.searchCat("Energy").getObjects().size() == 1);
 			assertTrue("Number of Objects on Canvas does not match", model.getObjectsOnCanvas().size() == 0);
 			assertTrue("Same instance of Category:Building", building != mp.searchCat("Building")
@@ -219,7 +219,7 @@ public class PraktikumHolonsTestLoadAndStoreController {
 			e.printStackTrace();
 		}
 	}
-	
+
 	/**
 	 * basic tests for loading a save file.
 	 */
@@ -231,8 +231,7 @@ public class PraktikumHolonsTestLoadAndStoreController {
 		assertTrue("Non-Existant Category Exists", mp.searchCat("I") == null);
 		assertTrue("Non-Existant Category Exists", mp.searchCat("A") == null);
 		assertTrue("Non-Existant Category Exists", mp.searchCat("N") == null);
-		
-		
+
 		try {
 			assertTrue("Objects on Canvas is not 0", model.getObjectsOnCanvas().size() == 0);
 			assertTrue("Canvas File was not found", new File(path + "TestCanvasBasic.json").exists());
@@ -243,7 +242,7 @@ public class PraktikumHolonsTestLoadAndStoreController {
 				assertTrue("Not instance of HolonObject", obj instanceof HolonObject || obj instanceof HolonSwitch);
 
 			}
-			
+
 			assertTrue("NUmber of Categories not match", model.getCategories().size() == 3);
 			assertTrue("Canvas File was not found", new File(path + "TestSavBasic.json").exists());
 			loadController.readJSON(path + "TestSavBasic.json");
@@ -260,37 +259,40 @@ public class PraktikumHolonsTestLoadAndStoreController {
 			assertTrue("Existant Object dont Exists", mp.searchCatObj(mp.searchCat("Z"), "D") != null);
 			assertTrue("Existant Object dont Exists", mp.searchCatObj(mp.searchCat("Z"), "E") != null);
 			assertTrue("Existant Object dont Exists", mp.searchCatObj(mp.searchCat("Z"), "F") != null);
-			
+
 		} catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
 	}
-	
+
 	/**
 	 * advanced tests for loading a save file.
 	 */
 	@Test
 	public void testLoadAdvanced() {
-		
+
 		try {
 			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 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);
-			
+			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)
+
+	@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");
@@ -299,7 +301,8 @@ public class PraktikumHolonsTestLoadAndStoreController {
 	/**
 	 * sets the graph points in all elements of an Object.
 	 * 
-	 * @param obj the Object
+	 * @param obj
+	 *            the Object
 	 */
 	public void setGraphPoints(HolonObject obj) {
 		LinkedList<Point> list = new LinkedList<>();

+ 2 - 1
src/tests/PraktikumHolonsTestSuite.java

@@ -19,7 +19,8 @@ public class PraktikumHolonsTestSuite {
 		suite.addTest(new JUnit4TestAdapter(PraktikumHolonsTestObjectController.class));
 		suite.addTest(new JUnit4TestAdapter(PraktikumHolonsTestLoadAndStoreController.class));
 		suite.addTest(new JUnit4TestAdapter(PraktikumHolonsTestGlobalController.class));
-//		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestAutoSaveController.class));
+		suite.addTest(new JUnit4TestAdapter(PraktikumHolonsTestAutoSaveController.class));
+		suite.addTest(new JUnit4TestAdapter(PraktikumHolonsTestConsoleController.class));
 		suite.addTest(new JUnit4TestAdapter(PraktikumHolonsTestClasses.class));
 		return suite;
 	}

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

@@ -14,6 +14,9 @@ public class AutoSaveController {
 		this.MODEL = model;
 	}
 
+	/**
+	 * Increase the Auto save number.
+	 */
 	public void increaseAutoSaveNr() {
 		currentSave = MODEL.getAutoSaveNr() + 1;
 		if (count < currentSave) {

+ 19 - 12
src/ui/controller/CanvasController.java

@@ -36,8 +36,9 @@ public class CanvasController {
 	}
 
 	/**
+	 * Add a new Object.
 	 * 
-	 * @param object
+	 * @param object the Object
 	 */
 	public void addNewObject(AbstractCpsObject object) {
 		object.setSav("CVS");
@@ -59,9 +60,9 @@ public class CanvasController {
 	}
 
 	/**
-	 * Deletes an CpsObject on the Canvas and its connections
+	 * Deletes an CpsObject on the Canvas and its connections.
 	 * 
-	 * @param AbstractCpsObject
+	 * @param obj AbstractCpsObject
 	 */
 	public void deleteObjectOnCanvas(AbstractCpsObject obj) {
 		CpsEdge e = null;
@@ -83,15 +84,19 @@ public class CanvasController {
 	}
 
 	/**
-	 * @param objectsOnCanvas
-	 *            the objectsOnCanvas to set
+	 * Add an edge to the Canvas.
+	 * 
+	 * @param edge
+	 *            the edge
 	 */
 	public void addEdgeOnCanvas(CpsEdge edge) {
 		MODEL.getEdgesOnCanvas().add(edge);
 	}
 
 	/**
-	 * @param edgesOnCanvas
+	 * Removes an Edge from the Canvas.
+	 * 
+	 * @param edge
 	 *            the edge to remove
 	 */
 	public void removeEdgesOnCanvas(CpsEdge edge) {
@@ -100,8 +105,10 @@ public class CanvasController {
 		MODEL.getEdgesOnCanvas().remove(edge);
 	}
 
+	
+	
 	/**
-	 * Copy all Selected Objects
+	 * Copy all Selected Objects.
 	 */
 	@SuppressWarnings("unchecked")
 	public void copyObjects() {
@@ -109,9 +116,9 @@ public class CanvasController {
 	}
 
 	/**
-	 * Paste all Selected Objects
+	 * Paste all Selected Objects.
 	 * 
-	 * @param Point
+	 * @param p
 	 *            the mouse Position
 	 */
 	public void pasteObjects(Point p) {
@@ -157,7 +164,7 @@ public class CanvasController {
 						&& MODEL.getClipboradObjects().indexOf(e.getB()) != -1) {
 					AbstractCpsObject A = tempList.get(MODEL.getClipboradObjects().indexOf(e.getA()));
 					AbstractCpsObject B = tempList.get(MODEL.getClipboradObjects().indexOf(e.getB()));
-					//was this Edge created or not?
+					// was this Edge created or not?
 					for (CpsEdge et : tempList.get(MODEL.getClipboradObjects().indexOf(cps)).getConnectedTo()) {
 						for (CpsEdge etA : et.getA().getConnectedTo()) {
 							if (et.getA() == A && et.getB() == B) {
@@ -187,12 +194,12 @@ public class CanvasController {
 	}
 
 	/**
-	 * Cut all Selected Objects
+	 * Cut all Selected Objects.
 	 */
 	@SuppressWarnings("unchecked")
 	public void cutObjects() {
 		MODEL.setClipboradObjects((ArrayList<AbstractCpsObject>) MODEL.getSelectedCpsObjects().clone());
-		
+
 		for (AbstractCpsObject cps : MODEL.getClipboradObjects()) {
 			deleteObjectOnCanvas(cps);
 		}

+ 34 - 14
src/ui/controller/CategoryController.java

@@ -22,7 +22,7 @@ public class CategoryController {
 	}
 
 	/**
-	 * init default category and objects
+	 * init default category and objects.
 	 */
 	public void initCategories() {
 
@@ -30,7 +30,8 @@ public class CategoryController {
 		addNewCategory("Building");
 		addNewCategory("Component");
 
-		addNewHolonObject(mpC.searchCat("Energy"), "Power Plant", new ArrayList<HolonElement>(), "/Images/power-plant.png");
+		addNewHolonObject(mpC.searchCat("Energy"), "Power Plant", new ArrayList<HolonElement>(),
+				"/Images/power-plant.png");
 		addNewHolonObject(mpC.searchCat("Building"), "House", new ArrayList<HolonElement>(), "/Images/home-2.png");
 		addNewHolonSwitch(mpC.searchCat("Component"), "Switch", "/Images/switch-on.png");
 
@@ -63,7 +64,7 @@ public class CategoryController {
 	}
 
 	/**
-	 * Adds New Category into Model
+	 * Adds New Category into Model.
 	 * 
 	 * @param name
 	 *            Bezeichnung der neuen Kategorie
@@ -74,7 +75,7 @@ public class CategoryController {
 	}
 
 	/**
-	 * remove a Category from Model
+	 * remove a Category from Model.
 	 */
 	public void removeCategory(Category c) {
 		mpC.decIdx(c.getName(), MODEL.getCgIdx());
@@ -85,16 +86,17 @@ public class CategoryController {
 	}
 
 	/**
-	 * delete a given Category
+	 * delete a given Category.
 	 * 
 	 * @param category
+	 *            the Category
 	 */
 	public void deleteCategory(String category) {
 		removeCategory(mpC.searchCat(category));
 	}
 
 	/**
-	 * Add Object into a Category
+	 * Add Object into a Category.
 	 * 
 	 * @param category
 	 *            Category
@@ -117,12 +119,16 @@ public class CategoryController {
 	}
 
 	/**
-	 * Add new Holon Object
+	 * Add new Holon Object to a Category.
 	 * 
-	 * @param cat
+	 * @param category
 	 *            Category
-	 * @param obj
+	 * @param object
 	 *            New Object Name
+	 * @param elements
+	 *            Array of Elements
+	 * @param image
+	 *            the image Path
 	 */
 	public void addNewHolonObject(Category category, String object, ArrayList<HolonElement> elements, String image) {
 		HolonObject obj = new HolonObject(object);
@@ -133,12 +139,14 @@ public class CategoryController {
 	}
 
 	/**
-	 * Add new Holon Transformer
+	 * Add new Holon Transformer.
 	 * 
 	 * @param cat
 	 *            Category
-	 * @param obj
+	 * @param objName
 	 *            New Object Name
+	 * @param image
+	 *            the image Path
 	 */
 	public void addNewHolonTransformer(Category cat, String objName, String image) {
 		HolonTransformer transformer = new HolonTransformer(objName);
@@ -148,12 +156,14 @@ public class CategoryController {
 	}
 
 	/**
-	 * Add new Holon Switch
+	 * Add new Holon Switch.
 	 * 
 	 * @param cat
 	 *            Category
-	 * @param obj
+	 * @param objName
 	 *            New Object Name
+	 * @param image
+	 *            the Image Path
 	 */
 	public void addNewHolonSwitch(Category cat, String objName, String image) {
 		HolonSwitch holonSwitch = new HolonSwitch(objName);
@@ -172,21 +182,31 @@ public class CategoryController {
 		notifyCatListeners();
 	}
 
+	/**
+	 * Delete an Object from a Category.
+	 * 
+	 * @param category
+	 *            the Category
+	 * @param obj
+	 *            the Object
+	 */
 	public void deleteObject(String category, String obj) {
 		Category cat = mpC.searchCat(category);
 		removeObject(cat, mpC.searchCatObj(cat, obj));
 	}
 
 	/**
+	 * Init the CategoryListener.
 	 * 
 	 * @param catLis
+	 *            the CategoryListener
 	 */
 	public void addCategoryListener(CategoryListener catLis) {
 		MODEL.getCategoryListeners().add(catLis);
 	}
 
 	/**
-	 * notifies all listeners about changes in the Categories
+	 * notifies all listeners about changes in the Categories.
 	 */
 	public void notifyCatListeners() {
 		for (CategoryListener l : MODEL.getCategoryListeners()) {

+ 323 - 38
src/ui/controller/Control.java

@@ -19,9 +19,15 @@ import ui.model.Model;
 import ui.view.MyCanvas;
 import ui.view.TimePanel;
 
+/**
+ * The Class represents the controller in the model, controller view Pattern.
+ * 
+ * @author Gruppe14
+ *
+ */
 public class Control {
 
-	private Model MODEL;
+	private Model model;
 
 	private ActionListener actionListener;
 
@@ -37,20 +43,26 @@ public class Control {
 	private SimulationManager simulationManager;
 	private String autoPath = "";
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            the Model
+	 */
 	public Control(Model model) {
-		this.MODEL = model;
-
-		this.multiPurposeController = new MultiPurposeController(MODEL);
-		this.categoryController = new CategoryController(MODEL, multiPurposeController);
-		this.objectController = new ObjectController(MODEL, multiPurposeController);
-		this.canvasController = new CanvasController(MODEL, multiPurposeController);
-		this.globalController = new GlobalController(MODEL);
-		this.storeController = new StoreController(MODEL);
-		this.loadController = new LoadController(MODEL, categoryController, canvasController, objectController,
+		this.model = model;
+
+		this.multiPurposeController = new MultiPurposeController(model);
+		this.categoryController = new CategoryController(model, multiPurposeController);
+		this.objectController = new ObjectController(model, multiPurposeController);
+		this.canvasController = new CanvasController(model, multiPurposeController);
+		this.globalController = new GlobalController(model);
+		this.storeController = new StoreController(model);
+		this.loadController = new LoadController(model, categoryController, canvasController, objectController,
 				multiPurposeController);
-		this.simulationManager = new SimulationManager(MODEL);
-		this.autoSaveController = new AutoSaveController(MODEL);
-		this.consoleController = new ConsoleController(MODEL);
+		this.simulationManager = new SimulationManager(model);
+		this.autoSaveController = new AutoSaveController(model);
+		this.consoleController = new ConsoleController(model);
 		autoPath = System.getProperty("user.home") + "/HolonGUI/Autosave/";
 		File dest = new File(autoPath);
 		//deleteDirectory(dest);
@@ -63,6 +75,12 @@ public class Control {
 		}
 	}
 
+	/**
+	 * Delete a Directory.
+	 * 
+	 * @param path
+	 *            to delete
+	 */
 	public void deleteDirectory(File path) {
 		if (path.exists()) {
 			File[] files = path.listFiles();
@@ -79,58 +97,148 @@ public class Control {
 
 	/* Operations for searching */
 
-	public AbstractCpsObject searchByID(int ID) {
-		return multiPurposeController.searchByID(ID);
+	/**
+	 * Search for Object by ID.
+	 * 
+	 * @param id the id of the Object
+	 * @return the CpsObject
+	 */
+	public AbstractCpsObject searchByID(int id) {
+		return multiPurposeController.searchByID(id);
 	}
 
+	/**
+	 * Search for Object in a Category.
+	 * 
+	 * @param category
+	 *            name of the Category
+	 * @param object
+	 *            Name of the Object
+	 * @return The Object
+	 */
 	public AbstractCpsObject searchCategoryObject(String category, String object) {
 		return multiPurposeController.searchCatObj(multiPurposeController.searchCat(category), object);
 	}
 
+	/**
+	 * search for category.
+	 * 
+	 * @param cat name of the Category
+	 * @return the Category
+	 */
 	public Category searchCategory(String cat) {
 		return multiPurposeController.searchCat(cat);
 	}
 
 	/* Operations for Categories and Objects */
+	
+	/**
+	 * init default category and objects.
+	 */
 	public void resetCategorys() {
 		categoryController.initCategories();
 	}
 
+	/**
+	 * Adds New Category into Model.
+	 * 
+	 * @param cat
+	 *            name of the new Category
+	 */
 	public void addCategory(String cat) {
 		categoryController.addNewCategory(cat);
 	}
 
+	/**
+	 * Add new Holon Object to a Category.
+	 * 
+	 * @param cat
+	 *            Category
+	 * @param obj
+	 *            New Object Name
+	 *            @param ele Array of Elements
+	 * @param img
+	 *            the image Path
+	 */
 	public void addObject(Category cat, String obj, ArrayList<HolonElement> ele, String img) {
 		categoryController.addNewHolonObject(cat, obj, ele, img);
 	}
 
+	/**
+	 * Add new Holon Transformer to a Category.
+	 * 
+	 * @param cat
+	 *            Category
+	 * @param obj
+	 *            New Object Name
+	 */
 	public void addTransformer(Category cat, String obj) {
 		categoryController.addNewHolonTransformer(cat, obj, "/Images/transformer-1.png");
 	}
 
+	/**
+	 * Add new Holon Switch to a Category.
+	 * 
+	 * @param cat
+	 *            Category
+	 * @param obj
+	 *            New Object Name
+	 */
 	public void addSwitch(Category cat, String obj) {
 		categoryController.addNewHolonSwitch(cat, obj, "/Images/switch-on.png");
 	}
 
+	/**
+	 * delete a given Category.
+	 * 
+	 * @param cat
+	 *            the Category
+	 */
 	public void deleteCategory(String cat) {
 		categoryController.deleteCategory(cat);
 	}
 
+	/**
+	 * Delete an Object from a Category.
+	 * 
+	 * @param cat
+	 *            the Category
+	 * @param obj
+	 *            the Object
+	 */
 	public void delObjectCategory(String cat, String obj) {
 		categoryController.deleteObject(cat, obj);
 	}
 
+	/**
+	 * deletes a selectedObject.
+	 * 
+	 * @param obj
+	 *            Cpsobject
+	 */
 	public void deleteSelectedObject(AbstractCpsObject obj) {
 		objectController.deleteSelectedObject(obj);
 	}
 
+	/**
+	 * add an Object to selectedObject.
+	 * 
+	 * @param obj
+	 *            AbstractCpsobject
+	 */
 	public void addSelectedObject(AbstractCpsObject obj) {
 		objectController.addSelectedObject(obj);
 	}
 
 	/* Operations for Canvas */
 
-	public void AddEdgeOnCanvas(CpsEdge edge) {
+	/**
+	 * Add an edge to the Canvas.
+	 * 
+	 * @param edge
+	 *            the edge
+	 */
+	public void addEdgeOnCanvas(CpsEdge edge) {
 		canvasController.addEdgeOnCanvas(edge);
 		try {
 			autoSave();
@@ -140,6 +248,12 @@ public class Control {
 		}
 	}
 
+	/**
+	 * Removes an Edge from the Canvas.
+	 * 
+	 * @param edge
+	 *            the edge to remove
+	 */
 	public void removeEdgesOnCanvas(CpsEdge edge) {
 		canvasController.removeEdgesOnCanvas(edge);
 		try {
@@ -150,10 +264,22 @@ public class Control {
 		}
 	}
 
+	/**
+	 * Set the selected Edge.
+	 * 
+	 * @param edge
+	 *            that is selected
+	 */
 	public void setSelecteEdge(CpsEdge edge) {
-		MODEL.setSelectedEdge(edge);
+		model.setSelectedEdge(edge);
 	}
 
+	/**
+	 * Add a new Object.
+	 * 
+	 * @param object
+	 *            the Object
+	 */
 	public void addObjectCanvas(AbstractCpsObject object) {
 		canvasController.addNewObject(object);
 		if (!(object instanceof CpsNode)) {
@@ -166,10 +292,22 @@ public class Control {
 		}
 	}
 
+	/**
+	 * Returns the ID of the selected Object 0 = no Object is selected.
+	 * 
+	 * @param id
+	 *            the ID of the selected Object
+	 */
 	public void setSelectedObjectID(int id) {
 		objectController.setSelectedObjectID(id);
 	}
 
+	/**
+	 * Deletes an CpsObject on the Canvas and its connections.
+	 * 
+	 * @param obj
+	 *            AbstractCpsObject
+	 */
 	public void delCanvasObject(AbstractCpsObject obj) {
 		canvasController.deleteObjectOnCanvas(obj);
 		try {
@@ -181,71 +319,187 @@ public class Control {
 	}
 
 	/* Operations for Objects and Elements */
-	public void addElementCanvasObject(int ID, String ele, int amount, float energy) {
-		objectController.addNewElementIntoCanvasObject(ID, ele, amount, energy);
+
+	/**
+	 * Add a new Element into a Object on the Canvas.
+	 * 
+	 * @param id
+	 *            the Object ID
+	 * @param ele
+	 *            the Name of the Element
+	 * @param amount
+	 *            the Amount
+	 * @param energy
+	 *            the Energy
+	 */
+	public void addElementCanvasObject(int id, String ele, int amount, float energy) {
+		objectController.addNewElementIntoCanvasObject(id, ele, amount, energy);
 	}
 
+	/**
+	 * Add a new Element into a Object in Category.
+	 * 
+	 * @param catName
+	 *            the Category
+	 * @param objName
+	 *            the Object
+	 * @param eleName
+	 *            the Element Name
+	 * @param amount
+	 *            the amount
+	 * @param energy
+	 *            the Energy
+	 */
 	public void addElementCategoryObject(String catName, String objName, String eleName, int amount, float energy) {
 		objectController.addNewElementIntoCategoryObject(catName, objName, eleName, amount, energy);
 	}
 
-	public void deleteElementCanvas(int id, int elementId) {
-		objectController.deleteElementInCanvas(id, elementId);
+	/**
+	 * deletes a Element from a given Canvas Object.
+	 * 
+	 * @param id
+	 *            the ID
+	 * @param elementid
+	 *            the Element ID
+	 */
+	public void deleteElementCanvas(int id, int elementid) {
+		objectController.deleteElementInCanvas(id, elementid);
 	}
 
+	/**
+	 * deletes a Element from a given Object.
+	 * 
+	 * @param obj
+	 *            the Oject
+	 * @param ele
+	 *            the Element
+	 */
 	public void deleteElementCanvas(HolonObject obj, HolonElement ele) {
 		objectController.deleteElement(obj, ele);
 	}
 
+	/**
+	 * Sets the ClipboardObjects.
+	 * 
+	 * @param list
+	 *            Array of Objects
+	 */
 	public void setClipboardObjects(ArrayList<AbstractCpsObject> list) {
-		MODEL.setClipboradObjects(list);
+		model.setClipboradObjects(list);
 	}
 
 	/* Global Operations */
+
+	/**
+	 * Returns SCALE.
+	 * 
+	 * @return SCALE
+	 */
 	public int getScale() {
 		return globalController.getScale();
 	}
 
+	/**
+	 * Returns SCALE Divided by 2.
+	 * 
+	 * @return SCALE Divided by 2
+	 */
 	public int getScaleDiv2() {
 		return globalController.getScaleDiv2();
 	}
 
+	/**
+	 * Changes the value of SCALE and SCALEDIV2.
+	 * 
+	 * @param s
+	 *            Scale
+	 */
 	public void setScale(int s) {
 		globalController.setScale(s);
 	}
 
-	public void setCurIteration(int cur_it) {
-		globalController.setCurIteration(cur_it);
+	/**
+	 * sets the current Iteration.
+	 * 
+	 * @param curit
+	 *            the current Iteration
+	 */
+	public void setCurIteration(int curit) {
+		globalController.setCurIteration(curit);
 	}
 
-	/* Operations for Loading and Storing */
+	/**
+	 * Writes the current State of the Modelling into a JSON File which can be
+	 * loaded.
+	 * 
+	 * @param path
+	 *            the Path
+	 * 
+	 * @throws IOException
+	 *             exception
+	 */
 	public void saveFile(String path) throws IOException {
 		storeController.writeSaveFile(path);
 	}
 
+	/**
+	 * Reads the the JSON File and load the state into the Model.
+	 * 
+	 * @param path
+	 *            the Path
+	 * @throws IOException
+	 *             exception
+	 */
 	public void loadFile(String path) throws IOException {
 		loadController.readJSON(path);
 	}
 
-	////////// etc
+	/**
+	 * Init the CategoryListener.
+	 * 
+	 * @param catLis
+	 *            the CategoryListener
+	 */
 	public void initListener(CategoryListener catLis) {
 		categoryController.addCategoryListener(catLis);
 	}
 
+	/**
+	 * calculates the flow of the edges and the supply for objects for the
+	 * current Timestep.
+	 */
 	public void calculateStateForCurrentTimeStep() {
 		simulationManager.reset();
-		simulationManager.calculateStateForTimeStep(MODEL.getCurIteration());
+		simulationManager.calculateStateForTimeStep(model.getCurIteration());
 	}
 
+	/**
+	 * calculates the flow of the edges and the supply for objects.
+	 * 
+	 * @param x
+	 *            current Iteration
+	 */
 	public void calculateStateForTimeStep(int x) {
 		simulationManager.reset();
 		simulationManager.calculateStateForTimeStep(x);
 	}
 
+	/**
+	 * Set the Canvas.
+	 * 
+	 * @param can
+	 *            the Canvas
+	 */
 	public void setCanvas(MyCanvas can) {
 		simulationManager.setCanvas(can);
 	}
 
+	/**
+	 * make an autosave.
+	 * 
+	 * @throws IOException
+	 *             Exception
+	 */
 	public void autoSave() throws IOException {
 		autoSaveController.increaseAutoSaveNr();
 		storeController.writeCanvasFile(autoPath + autoSaveController.getAutoSaveNr());
@@ -254,6 +508,11 @@ public class Control {
 		}
 	}
 
+	/**
+	 * Returns the undo save.
+	 * 
+	 * @return the undo save
+	 */
 	public String getUndoSave() {
 		autoSaveController.decreaseAutoSaveNr();
 		if (!new File(autoPath + (autoSaveController.getAutoSaveNr())).exists()) {
@@ -262,6 +521,11 @@ public class Control {
 		return autoPath + (autoSaveController.getAutoSaveNr());
 	}
 
+	/**
+	 * Returns the redo save.
+	 * 
+	 * @return the redo save
+	 */
 	public String getRedoSave() {
 		autoSaveController.increaseAutoSaveNr();
 		if (!new File(autoPath + (autoSaveController.getAutoSaveNr())).exists()) {
@@ -270,10 +534,19 @@ public class Control {
 		return autoPath + (autoSaveController.getAutoSaveNr());
 	}
 
+	/**
+	 * Copy all Selected Objects.
+	 */
 	public void copyObjects() {
 		canvasController.copyObjects();
 	}
 
+	/**
+	 * Paste all Selected Objects.
+	 * 
+	 * @param point
+	 *            the mouse Position
+	 */
 	public void pasteObjects(Point point) {
 		canvasController.pasteObjects(point);
 		try {
@@ -284,6 +557,9 @@ public class Control {
 		}
 	}
 
+	/**
+	 * Cut all Selected Objects.
+	 */
 	public void cutObjects() {
 		canvasController.cutObjects();
 		try {
@@ -295,20 +571,25 @@ public class Control {
 	}
 
 	/**
-	 * Getter for Model
+	 * Getter for Model.
 	 * 
-	 * @return
+	 * @return the Model
 	 */
 	public Model getModel() {
-		return MODEL;
+		return model;
 	}
 
+	/**
+	 * get the Simulation Manager.
+	 * 
+	 * @return the Simulation Manager
+	 */
 	public SimulationManager getSimManager() {
 		return simulationManager;
 	}
 
 	/**
-	 * Getter for selected CpsObject
+	 * Getter for selected CpsObject.
 	 *
 	 * @param text
 	 *            String the Text
@@ -320,17 +601,16 @@ public class Control {
 	 *            bold or not
 	 * @param italic
 	 *            italic or not
-	 * @param ln
+	 * @param nl
 	 *            new line or not
 	 * 
-	 * @return selected CpsObject
 	 */
 	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
+	 * Print Text on the console in black and font size 12.
 	 *
 	 * @param text
 	 *            String the Text
@@ -340,22 +620,27 @@ public class Control {
 	}
 
 	/**
-	 * Clears the console
+	 * Clears the console.
 	 */
 	public void clearConsole() {
 		consoleController.clearConsole();
 	}
 
 	/**
-	 * @return sets the timerSpeed
+	 * Set the timerSpeed.
+	 * 
+	 * @param t
+	 *            interval in ms
 	 */
 	public void setTimerSpeed(int t) {
 		globalController.setTimerSpeed(t);
 	}
 
 	/**
-	 * @param isSimulation
-	 *            boolean for for isSimulation
+	 * Set if its simulating or not.
+	 * 
+	 * @param b
+	 *            isSimulation
 	 */
 	public void setIsSimulation(boolean b) {
 		globalController.setIsSimulation(b);

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

@@ -11,7 +11,7 @@ public class GlobalController {
 	}
 
 	/**
-	 * Returns SCALE
+	 * Returns SCALE.
 	 * 
 	 * @return SCALE
 	 */
@@ -20,7 +20,7 @@ public class GlobalController {
 	}
 
 	/**
-	 * Returns SCALE Divided by 2
+	 * Returns SCALE Divided by 2.
 	 * 
 	 * @return SCALE Divided by 2
 	 */
@@ -29,9 +29,9 @@ public class GlobalController {
 	}
 
 	/**
-	 * Changes the value of SCALE and SCALEDIV2
+	 * Changes the value of SCALE and SCALEDIV2.
 	 * 
-	 * @param int
+	 * @param s
 	 *            Scale
 	 */
 	public void setScale(int s) {
@@ -39,13 +39,13 @@ public class GlobalController {
 	}
 
 	/**
-	 * sets the current Iteration
+	 * sets the current Iteration.
 	 * 
-	 * @param cur_it,
+	 * @param curit
 	 *            the current Iteration
 	 */
-	public void setCurIteration(int cur_it) {
-		MODEL.setCurIteration(cur_it);
+	public void setCurIteration(int curit) {
+		MODEL.setCurIteration(curit);
 	}
 
 	/**

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

@@ -47,10 +47,10 @@ public class LoadController {
 	}
 
 	/**
-	 * Reads the the JSON File and load the state into the Model
+	 * Reads the the JSON File and load the state into the Model.
 	 * 
-	 * @param path
-	 * @throws IOException
+	 * @param path the Path
+	 * @throws IOException exception
 	 */
 	public void readJSON(String path) throws IOException {
 		JSONParser parser = new JSONParser();

+ 14 - 12
src/ui/controller/MultiPurposeController.java

@@ -20,10 +20,11 @@ public class MultiPurposeController {
 	}
 
 	/**
-	 * search for category
+	 * search for category.
 	 * 
-	 * @param name
-	 * @return
+	 * @param category
+	 *            name of the Category
+	 * @return the Category
 	 */
 	public Category searchCat(String category) {
 
@@ -36,11 +37,13 @@ public class MultiPurposeController {
 	}
 
 	/**
-	 * Search for Object
+	 * Search for Object in a Category.
 	 * 
+	 * @param category
+	 *            name of the Category
 	 * @param object
-	 * @param list
-	 * @return
+	 *            Name of the Object
+	 * @return The Object
 	 */
 	public AbstractCpsObject searchCatObj(Category category, String object) {
 
@@ -53,17 +56,16 @@ public class MultiPurposeController {
 	}
 
 	/**
-	 * Search for Object by ID
+	 * Search for Object by ID.
 	 * 
-	 * @param ID
-	 * @param list
-	 * @return
+	 * @param id the ID of the Object
+	 * @return the CpsObject
 	 */
-	public AbstractCpsObject searchByID(int ID) {
+	public AbstractCpsObject searchByID(int id) {
 
 		Integer idx;
 
-		if ((idx = MODEL.getCvsObjIdx().get(ID)) == null || MODEL.getCvsObjIdx().size() < 1)
+		if ((idx = MODEL.getCvsObjIdx().get(id)) == null || MODEL.getCvsObjIdx().size() < 1)
 			return null;
 		else
 			return MODEL.getObjectsOnCanvas().get(idx);

+ 33 - 26
src/ui/controller/ObjectController.java

@@ -54,13 +54,12 @@ public class ObjectController {
 	}
 
 	/**
-	 * Add a new Element into a Object on the Canvas
+	 * Add a new Element into a Object on the Canvas.
 	 * 
-	 * @param object
-	 * @param eleName
-	 * @param amount
-	 * @param energy
-	 * @param type
+	 * @param id the Object ID
+	 * @param element the Name of the Element
+	 * @param amount the Amount
+	 * @param energy the Energy
 	 */
 	public void addNewElementIntoCanvasObject(int id, String element, int amount, float energy) {
 		HolonElement ele = new HolonElement(element, amount, energy);
@@ -68,7 +67,7 @@ public class ObjectController {
 	}
 
 	/**
-	 * Add Element into a Object in Category
+	 * Add Element into a Object in Category.
 	 * 
 	 * @param object
 	 * @param element
@@ -80,13 +79,18 @@ public class ObjectController {
 	}
 
 	/**
-	 * Add a new Element into a Object in Category
+	 * Add a new Element into a Object in Category.
 	 * 
 	 * @param category
+	 *            the Category
 	 * @param object
-	 * @param eleName
-	 * @param amount
+	 *            the Object
+	 * @param element
+	 *            the Element Name
 	 * @param energy
+	 *            the Energy
+	 * @param amount
+	 *            the amount
 	 */
 	public void addNewElementIntoCategoryObject(String category, String object, String element, int amount,
 			float energy) {
@@ -96,10 +100,12 @@ public class ObjectController {
 	}
 
 	/**
-	 * deletes a Element from a given Object
+	 * deletes a Element from a given Object.
 	 * 
 	 * @param obj
+	 *            the Oject
 	 * @param ele
+	 *            the Element
 	 */
 	public void deleteElement(HolonObject obj, HolonElement ele) {
 		System.out.println(ele.getEleName() + " and " + obj.getEleIdx());
@@ -109,33 +115,34 @@ public class ObjectController {
 	}
 
 	/**
-	 * deletes a selectedObject
+	 * deletes a selectedObject.
 	 * 
-	 * @param Cpsobject
+	 * @param obj Cpsobject
 	 */
 	public void deleteSelectedObject(AbstractCpsObject obj) {
 		MODEL.getSelectedCpsObjects().remove(obj);
 	}
 
 	/**
-	 * 	s a selectedObject
+	 * add an Object to selectedObject.
 	 * 
-	 * @param Cpsobject
+	 * @param obj AbstractCpsobject
 	 */
 	public void addSelectedObject(AbstractCpsObject obj) {
 		MODEL.getSelectedCpsObjects().add(obj);
 	}
 
 	/**
-	 * deletes a Element from a given Canvas Object
+	 * deletes a Element from a given Canvas Object.
 	 * 
-	 * @param ID
-	 * @param ele
-	 * @param amount
+	 * @param id
+	 *            the ID
+	 * @param eleid
+	 *            the Element ID
 	 */
-	public void deleteElementInCanvas(int ID, int eleId) {
-		HolonObject object = (HolonObject) mpC.searchByID(ID);
-		HolonElement element = mpC.searchEleById(object, eleId);
+	public void deleteElementInCanvas(int id, int eleid) {
+		HolonObject object = (HolonObject) mpC.searchByID(id);
+		HolonElement element = mpC.searchEleById(object, eleid);
 		// mpC.searchEle(object, ele);
 		System.out.println(object.getName() + " and " + element.getEleName());
 		deleteElement(object, element);
@@ -158,18 +165,18 @@ public class ObjectController {
 	}
 
 	/**
-	 * 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
+	 * @param id the ID of the selected Object
 	 */
 	public void setSelectedObjectID(int id) {
 		MODEL.setSelectedObjectID(id);
 	}
 
 	/**
-	 * sets clipBoardObjects
+	 * sets clipBoardObjects.
 	 * 
-	 * @param ArrayList
+	 * @param list
 	 *            of CpsObjects
 	 */
 	public void setClipboardObjects(ArrayList<AbstractCpsObject> list) {

+ 16 - 2
src/ui/controller/SimulationManager.java

@@ -31,9 +31,9 @@ public class SimulationManager {
 	}
 
 	/**
-	 * calculates the flow of the edges and the supply for objects
+	 * calculates the flow of the edges and the supply for objects.
 	 * 
-	 * @param x
+	 * @param x current Iteration
 	 */
 	public void calculateStateForTimeStep(int x) {
 		simMode = model.getIsSimulation();
@@ -422,14 +422,28 @@ public class SimulationManager {
 		}
 	}
 
+	/**
+	 * Set the Canvas.
+	 * 
+	 * @param can
+	 *            the Canvas
+	 */
 	public void setCanvas(MyCanvas can) {
 		canvas = can;
 	}
 
+	/**
+	 * Reset all Data to the current state of the Model.
+	 */
 	public void reset() {
 		copyObjects(model.getObjectsOnCanvas());
 	}
 
+	/**
+	 * Get all Subnets.
+	 * 
+	 * @return all Subnets
+	 */
 	public ArrayList<SubNet> getSubNets() {
 		return subNets;
 	}

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

@@ -29,9 +29,10 @@ public class StoreController {
 
 	/**
 	 * Writes the current State of the Modelling into a JSON File which can be
-	 * loaded
+	 * loaded.
+	 * @param path the Path
 	 * 
-	 * @throws IOException
+	 * @throws IOException exception
 	 */
 	public void writeSaveFile(String path) throws IOException {
 

+ 6 - 0
src/ui/view/GUI.java

@@ -1785,6 +1785,12 @@ public class GUI<E> implements CategoryListener {
 		}
 	}
 
+	/**
+	 * Adds a Popup.
+	 * 
+	 * @param component Component
+	 * @param popup PopupMenu
+	 */
 	private static void addPopup(Component component, final JPopupMenu popup) {
 		component.addMouseListener(new MouseAdapter() {
 			public void mousePressed(MouseEvent e) {

+ 7 - 5
src/ui/view/MyCanvas.java

@@ -368,6 +368,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				controller.addTextToConsole(", ID:", Color.BLACK, 12, false, false, false);
 				controller.addTextToConsole("" + cps.getID(), Color.RED, 12, true, false, true);
 				dragging = true;
+				controller.setSelectedObjectID(tempCps.getID());
 				// If drawing an Edge (CTRL down)
 				if (tempCps.getClass() == HolonObject.class) {
 					HolonObject tempObj = ((HolonObject) tempCps);
@@ -411,6 +412,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			model.getSelectedCpsObjects().clear();
 			controller.addSelectedObject(tempCps);
 		}
+		
 		if (dragged == true) {
 			try {
 				controller.autoSave();
@@ -610,7 +612,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				}
 				if (newEdge) {
 					e = new CpsEdge(cps, tempCps, edgeCapacity);
-					controller.AddEdgeOnCanvas(e);
+					controller.addEdgeOnCanvas(e);
 				}
 			}
 		}
@@ -639,9 +641,9 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				e2 = new CpsEdge(n, k, edgeCapacity);
 
 				controller.removeEdgesOnCanvas(p);
-				controller.AddEdgeOnCanvas(e);
-				controller.AddEdgeOnCanvas(e1);
-				controller.AddEdgeOnCanvas(e2);
+				controller.addEdgeOnCanvas(e);
+				controller.addEdgeOnCanvas(e1);
+				controller.addEdgeOnCanvas(e2);
 			}
 		}
 
@@ -654,7 +656,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 
 			e = new CpsEdge(n, tempCps, edgeCapacity);
 
-			controller.AddEdgeOnCanvas(e);
+			controller.addEdgeOnCanvas(e);
 		}
 
 		// Wenn ein Node ohne Connections da ist

+ 5 - 1
src/ui/view/PropertyTable.java

@@ -1,7 +1,11 @@
 package ui.view;
 
 import javax.swing.table.DefaultTableModel;
-
+/**
+ * Property Table.
+ * 
+ * @author Gruppe14
+ */
 public class PropertyTable extends DefaultTableModel {
 
 	@Override

+ 26 - 12
src/ui/view/SearchPopUp.java

@@ -18,13 +18,18 @@ import javax.swing.JRadioButton;
 import javax.swing.JButton;
 
 import ui.controller.Control;
-import ui.controller.MultiPurposeController;
-
 import java.awt.event.ActionListener;
 import java.util.ArrayList;
 import java.awt.event.ActionEvent;
 
+/**
+ * This Class represents a popup to seatch for Objects on the Canvas.
+ * 
+ * @author Gruppe14
+ */
 public class SearchPopUp extends JDialog {
+
+	private static final long serialVersionUID = 1L;
 	private final JPanel contentPanel = new JPanel();
 	private JTextField replaceTextField;
 	private JTextField findTextField;
@@ -36,6 +41,11 @@ public class SearchPopUp extends JDialog {
 	private JRadioButton rdbtnSingle;
 	private int idx;
 
+	/**
+	 * Constructor.
+	 * @param contr Controller
+	 * @param can Canvas
+	 */
 	SearchPopUp(Control contr, MyCanvas can) {
 		super((java.awt.Frame) null, true);
 		idx = -1;
@@ -204,35 +214,38 @@ public class SearchPopUp extends JDialog {
 	}
 
 	/**
-	 * 
-	 * @param obj
+	 * add the searched Objects to the Selected Objects.
+	 * @param obj The Object
 	 */
 	public void selectObj(AbstractCpsObject obj) {
 		controller.getModel().getSelectedCpsObjects().add(obj);
 	}
 
 	/**
+	 * Rename an Object.
 	 * 
-	 * @param obj
-	 * @param name
+	 * @param obj the Object
+ 	 * @param name the new name
 	 */
 	public void renameObj(AbstractCpsObject obj, String name) {
 		obj.setName(name);
 	}
 
 	/**
+	 * get the Object with the specific ID.
 	 * 
-	 * @param idx
-	 * @return
+	 * @param idx the ID
+	 * @return the Object with that ID
 	 */
 	public AbstractCpsObject getObj(int idx) {
 		return controller.getModel().getObjectsOnCanvas().get(idx);
 	}
 
 	/**
+	 * Get the next Object ID.
 	 * 
-	 * @param idx
-	 * @return
+	 * @param idx the Index
+	 * @return the next Index
 	 */
 	public int getNext(int idx) {
 		for (int i = idx; i < controller.getModel().getObjectsOnCanvas().size(); i++) {
@@ -249,9 +262,10 @@ public class SearchPopUp extends JDialog {
 	}
 
 	/**
+	 * Get the previous Index.
 	 * 
-	 * @param idx
-	 * @return
+	 * @param idx the Index
+	 * @return the previousIndex
 	 */
 	public int getPrev(int idx) {
 		for (int i = idx; i >= 0; i--) {

+ 30 - 9
src/ui/view/ShowedInformationPopUp.java

@@ -10,14 +10,27 @@ import javax.swing.JButton;
 import java.awt.event.ActionListener;
 import java.awt.event.ActionEvent;
 
-public class ShowedInformationPopUp extends JDialog{
+/**
+ * This Class represents a Popup to edit the shown Information.
+ * 
+ * @author Gruppe14
+ */
+public class ShowedInformationPopUp extends JDialog {
+
+	private static final long serialVersionUID = 1L;
 	private final JPanel contentPanel = new JPanel();
 	private final JButton btnOk = new JButton("OK");
 	private MyCanvas canvas;
 	private JCheckBox objectEnergyCheckbox;
 	private JCheckBox connectionCheckbox;
-	
-	public ShowedInformationPopUp(MyCanvas canvas){
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param canvas
+	 *            the Canvas
+	 */
+	public ShowedInformationPopUp(MyCanvas canvas) {
 		super((java.awt.Frame) null, true);
 		setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
 		this.setTitle("Edit Showed Informations");
@@ -27,15 +40,15 @@ public class ShowedInformationPopUp extends JDialog{
 		getContentPane().add(contentPanel, BorderLayout.CENTER);
 		contentPanel.setLayout(null);
 		this.canvas = canvas;
-		
+
 		objectEnergyCheckbox = new JCheckBox("Show Total Energy of Objects");
 		objectEnergyCheckbox.setBounds(19, 19, 181, 23);
 		contentPanel.add(objectEnergyCheckbox);
-		
+
 		connectionCheckbox = new JCheckBox("Show Connection Properties");
 		connectionCheckbox.setBounds(19, 57, 181, 23);
 		contentPanel.add(connectionCheckbox);
-		
+
 		objectEnergyCheckbox.setSelected(canvas.getShowedInformation()[1]);
 		connectionCheckbox.setSelected(canvas.getShowedInformation()[0]);
 		btnOk.addActionListener(new ActionListener() {
@@ -46,7 +59,7 @@ public class ShowedInformationPopUp extends JDialog{
 		});
 		btnOk.setBounds(169, 98, 82, 23);
 		contentPanel.add(btnOk);
-		
+
 		JButton btnCancel = new JButton("Cancel");
 		btnCancel.setActionCommand("Cancel");
 		btnCancel.addActionListener(new ActionListener() {
@@ -57,8 +70,16 @@ public class ShowedInformationPopUp extends JDialog{
 		btnCancel.setBounds(70, 98, 89, 23);
 		contentPanel.add(btnCancel);
 	}
-	
-	private void setInformation(boolean connection, boolean object){
+
+	/**
+	 * Set the Information true or false.
+	 * 
+	 * @param connection
+	 *            conecction Information
+	 * @param object
+	 *            Object Information
+	 */
+	private void setInformation(boolean connection, boolean object) {
 		canvas.setShowedInformation(connection, object);
 		canvas.repaint();
 	}

+ 53 - 41
src/ui/view/SimulationMenu.java

@@ -38,10 +38,14 @@ import java.beans.PropertyChangeListener;
 import java.io.File;
 import java.awt.FlowLayout;
 
+/**
+ * This Class represents the Menu, where you can edit stuff about the
+ * Simulation.
+ * 
+ * @author Gruppe14
+ */
 public class SimulationMenu extends JMenuBar {
-	/**
-	 * 
-	 */
+
 	private static final long serialVersionUID = 1L;
 
 	private JPanel menuPanel = new JPanel();
@@ -55,6 +59,14 @@ public class SimulationMenu extends JMenuBar {
 	Model model;
 	Control controller;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param mod
+	 *            the Model
+	 * @param cont
+	 *            the Controller
+	 */
 	public SimulationMenu(Model mod, Control cont) {
 		super();
 		// Init Stuff
@@ -93,12 +105,12 @@ public class SimulationMenu extends JMenuBar {
 		});
 
 		// Add to Panel
-		GridBagLayout gbl_menuPanel = new GridBagLayout();
-		gbl_menuPanel.columnWidths = new int[] { 79, 105, 34, 60, 31, 151, 0 };
-		gbl_menuPanel.rowHeights = new int[] { 25, 0 };
-		gbl_menuPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
-		gbl_menuPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
-		menuPanel.setLayout(gbl_menuPanel);
+		GridBagLayout gblmenuPanel = new GridBagLayout();
+		gblmenuPanel.columnWidths = new int[] { 79, 105, 34, 60, 31, 151, 0 };
+		gblmenuPanel.rowHeights = new int[] { 25, 0 };
+		gblmenuPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
+		gblmenuPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
+		menuPanel.setLayout(gblmenuPanel);
 
 		// isSimulation
 		simButton.addPropertyChangeListener(new PropertyChangeListener() {
@@ -109,18 +121,18 @@ public class SimulationMenu extends JMenuBar {
 				controller.calculateStateForCurrentTimeStep();
 			}
 		});
-		GridBagConstraints gbc_simButton = new GridBagConstraints();
-		gbc_simButton.anchor = GridBagConstraints.NORTHWEST;
-		gbc_simButton.insets = new Insets(0, 0, 0, 5);
-		gbc_simButton.gridx = 0;
-		gbc_simButton.gridy = 0;
-		menuPanel.add(simButton, gbc_simButton);
-		GridBagConstraints gbc_simSpeedLabel = new GridBagConstraints();
-		gbc_simSpeedLabel.anchor = GridBagConstraints.WEST;
-		gbc_simSpeedLabel.insets = new Insets(0, 0, 0, 5);
-		gbc_simSpeedLabel.gridx = 1;
-		gbc_simSpeedLabel.gridy = 0;
-		menuPanel.add(simSpeedLabel, gbc_simSpeedLabel);
+		GridBagConstraints gbcsimButton = new GridBagConstraints();
+		gbcsimButton.anchor = GridBagConstraints.NORTHWEST;
+		gbcsimButton.insets = new Insets(0, 0, 0, 5);
+		gbcsimButton.gridx = 0;
+		gbcsimButton.gridy = 0;
+		menuPanel.add(simButton, gbcsimButton);
+		GridBagConstraints gbcsimSpeedLabel = new GridBagConstraints();
+		gbcsimSpeedLabel.anchor = GridBagConstraints.WEST;
+		gbcsimSpeedLabel.insets = new Insets(0, 0, 0, 5);
+		gbcsimSpeedLabel.gridx = 1;
+		gbcsimSpeedLabel.gridy = 0;
+		menuPanel.add(simSpeedLabel, gbcsimSpeedLabel);
 
 		// timerSpeed
 		simSpeedText.setMaximumSize(new Dimension(300, 300));
@@ -129,31 +141,31 @@ public class SimulationMenu extends JMenuBar {
 			public void caretUpdate(CaretEvent e) {
 				try {
 					controller.setTimerSpeed(Integer.parseInt(simSpeedText.getText()));
-				} catch (Exception e2) {
+				} catch (Exception ex) {
 					// TODO: handle exception
 				}
 
 			}
 		});
-		GridBagConstraints gbc_simSpeedText = new GridBagConstraints();
-		gbc_simSpeedText.anchor = GridBagConstraints.WEST;
-		gbc_simSpeedText.insets = new Insets(0, 0, 0, 5);
-		gbc_simSpeedText.gridx = 2;
-		gbc_simSpeedText.gridy = 0;
-		menuPanel.add(simSpeedText, gbc_simSpeedText);
-		GridBagConstraints gbc_algoFolderButton = new GridBagConstraints();
-		gbc_algoFolderButton.anchor = GridBagConstraints.WEST;
-		gbc_algoFolderButton.insets = new Insets(0, 0, 0, 5);
-		gbc_algoFolderButton.gridx = 3;
-		gbc_algoFolderButton.gridy = 0;
-		menuPanel.add(algoFolderButton, gbc_algoFolderButton);
-
-		GridBagConstraints gbc_algoCombo = new GridBagConstraints();
-		gbc_algoCombo.anchor = GridBagConstraints.WEST;
-		gbc_algoCombo.insets = new Insets(0, 0, 0, 5);
-		gbc_algoCombo.gridx = 4;
-		gbc_algoCombo.gridy = 0;
-		menuPanel.add(algoCombo, gbc_algoCombo);
+		GridBagConstraints gbcSimSpeedText = new GridBagConstraints();
+		gbcSimSpeedText.anchor = GridBagConstraints.WEST;
+		gbcSimSpeedText.insets = new Insets(0, 0, 0, 5);
+		gbcSimSpeedText.gridx = 2;
+		gbcSimSpeedText.gridy = 0;
+		menuPanel.add(simSpeedText, gbcSimSpeedText);
+		GridBagConstraints gbcAlgoFolderButton = new GridBagConstraints();
+		gbcAlgoFolderButton.anchor = GridBagConstraints.WEST;
+		gbcAlgoFolderButton.insets = new Insets(0, 0, 0, 5);
+		gbcAlgoFolderButton.gridx = 3;
+		gbcAlgoFolderButton.gridy = 0;
+		menuPanel.add(algoFolderButton, gbcAlgoFolderButton);
+
+		GridBagConstraints gbcAlgoCombo = new GridBagConstraints();
+		gbcAlgoCombo.anchor = GridBagConstraints.WEST;
+		gbcAlgoCombo.insets = new Insets(0, 0, 0, 5);
+		gbcAlgoCombo.gridx = 4;
+		gbcAlgoCombo.gridy = 0;
+		menuPanel.add(algoCombo, gbcAlgoCombo);
 		algoCombo.addItem("choose folder");
 
 		// Add Panel to SimulationMenu

+ 16 - 4
src/ui/view/TimePanel.java

@@ -19,7 +19,12 @@ import javax.swing.event.ChangeListener;
 import ui.controller.Control;
 import ui.model.Model;
 import javax.swing.BoxLayout;
-
+/**
+ * This Class represents a Panel where the User can start and stop the Simulation.
+ * He Can also reset the Simulation and click through every Iteration.
+ * 
+ * @author Gruppe14
+ */
 public class TimePanel extends JPanel {
 
 	private Model model;
@@ -34,11 +39,13 @@ public class TimePanel extends JPanel {
 	private Timer timer;
 	private boolean running = false;
 
-	/**
-	 * 
-	 */
 	private static final long serialVersionUID = 1L;
 
+	/**
+	 * Constructor.
+	 * @param mod the Model
+	 * @param cont the Controller
+	 */
 	public TimePanel(Model mod, Control cont) {
 		super();
 		this.model = mod;
@@ -158,6 +165,11 @@ public class TimePanel extends JPanel {
 		this.add(timeSlider);
 	}
 	
+	/**
+	 * Retunrs the TimeSlider.
+	 * 
+	 * @return the TimeSlider
+	 */
 	public JSlider getTimeSlider(){
 		return timeSlider;
 	}

+ 74 - 41
src/ui/view/UnitGraph.java

@@ -26,10 +26,16 @@ import classes.HolonSwitch;
 
 import java.awt.Cursor;
 
+/**
+ * This Class represents a Graph where the User can model the behavior of
+ * elements and switches over time.
+ * 
+ * @author Gruppe14
+ */
 public class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, ComponentListener {
 
 	private static final long serialVersionUID = 1L;
-	private float MAXIMUM = 0;
+	private float maximum = 0;
 
 	// Information shown when a Point is Dragged
 	private String dragInformation = "";
@@ -66,6 +72,14 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	private double x = 0, y = 0;
 	private int x1, x2, y1, y2, ctrlx1, ctrly1, ctrlx2, ctrly2;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            the Model
+	 * @param control
+	 *            the Controller
+	 */
 	public UnitGraph(final Model model, Control control) {
 		setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
 		this.controller = control;
@@ -80,9 +94,10 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * Paints all Components on the Canvas
+	 * Paints all Components on the Canvas.
 	 * 
-	 * @param Graphics
+	 * @param g
+	 *            Graphics
 	 * 
 	 */
 	public void paintComponent(Graphics g) {
@@ -213,9 +228,10 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * Wenn ein Punkt bei einem HolonElement gedragged wird
+	 * When a Point of a Holon Element is dragged.
 	 * 
 	 * @param e
+	 *            MouseEvent
 	 */
 	public void elementDragged(MouseEvent e) {
 		if (pointDrag && tempP != null) {
@@ -241,9 +257,10 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * Wenn ein Punkt bei einem CpsSwitch gedragged wird
+	 * When a Point of a switch is dragged.
 	 * 
 	 * @param e
+	 *            MouseEvent
 	 */
 	public void switchDragged(MouseEvent e) {
 		if (pointDrag && tempP != null && tempP != pointList.getFirst() && tempP != pointList.getLast()) {
@@ -295,9 +312,10 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * Wenn ein Punkt von einem Element gedrueckt wird
+	 * When a point of a Holon Element is pressed.
 	 * 
 	 * @param e
+	 *            MouseEvent
 	 */
 	public void elementPressed(MouseEvent e) {
 		boolean added = false;
@@ -349,9 +367,10 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * Wenn ein Punkt von einem Switch gedr�ck wird
+	 * When a point of a Switch is pressed.
 	 * 
 	 * @param e
+	 *            MouseEvent
 	 */
 	public void switchPressed(MouseEvent e) {
 		boolean added = false;
@@ -431,10 +450,19 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 			pointDrag = false;
 			tempP = null;
 		}
+		/**
+		 * reset the dragInformation.
+		 */
 		dragInformation = "";
 		repaint();
 	}
 
+	/**
+	 * When the Component is Resized.
+	 * 
+	 * @param e
+	 *            ComponentEvent
+	 */
 	public void componentResized(ComponentEvent e) {
 		// Wenn ein anderes Element genommen wird
 		if (init) {
@@ -468,8 +496,8 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	public void componentShown(ComponentEvent e) {
 	}
 
-	/*
-	 * Empty the Graph
+	/**
+	 * Empty the Graph.
 	 */
 	public void empty() {
 		pointList = null;
@@ -481,8 +509,8 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 		repaint();
 	}
 
-	/*
-	 * Resets the Points for the Element
+	/**
+	 * Resets the Points for the Element.
 	 */
 	public void reset() {
 		pointList.removeAll(pointList);
@@ -492,32 +520,32 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * converts the number to fit the canvas
+	 * converts the number to fit the canvas.
 	 * 
-	 * @param double
-	 *            d, the number to convert
+	 * @param d
+	 *            the number to convert
 	 * @return the converted number
 	 */
 	public double convertToCanvasY(float d) {
-		return (height - (d * (height / MAXIMUM)));
+		return (height - (d * (height / maximum)));
 	}
 
 	/**
-	 * converts the number to fit the value
+	 * converts the number to fit the value.
 	 * 
-	 * @param double
-	 *            d, the number to convert
+	 * @param d
+	 *            the number to convert
 	 * @return the converted number
 	 */
 	public float convertToValueY(double d) {
-		return (float) Math.round(((height - (height * (d / height))) / (height / MAXIMUM)) * 10) / 10;
+		return (float) Math.round(((height - (height * (d / height))) / (height / maximum)) * 10) / 10;
 	}
 
 	/**
-	 * Visualize the HolonElement on the Graph
+	 * Visualize the HolonElement on the Graph.
 	 * 
-	 * @param HolonElement
-	 *            ele, which should be visualized
+	 * @param selectedElement
+	 *            which should be visualized
 	 */
 	public void repaintWithNewElement(ArrayList<HolonElement> selectedElement) {
 		arrayOfFloats = selectedElement.get(selectedElement.size() - 1).getEnergyAt();
@@ -525,7 +553,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 		pointList = selectedElement.get(selectedElement.size() - 1).getGraphPoints();
 		isSwitch = false;
 		isElement = true;
-		MAXIMUM = selectedElement.get(selectedElement.size() - 1).getEnergy();
+		maximum = selectedElement.get(selectedElement.size() - 1).getEnergy();
 		// First time clicked on the Element
 		if (pointList.isEmpty()) {
 			pointList.addFirst(new Point(0, 0));
@@ -535,10 +563,10 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * Visualize the HolonElement on the Graph
+	 * Visualize the Switch on the Graph.
 	 * 
-	 * @param HolonElement
-	 *            ele, which should be visualized
+	 * @param s
+	 *            which should be visualized
 	 */
 	public void repaintWithNewSwitch(HolonSwitch s) {
 		arrayOfBooleans = s.getActiveAt();
@@ -554,12 +582,14 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * Build a Curve for the Graph
+	 * Build a Curve for the Graph.
 	 * 
-	 * @param Point,Point
-	 *            ,startpoint p1 and endpoint p2
+	 * @param p1
+	 *            startpoint
+	 * @param p2
+	 *            endpoint
 	 * 
-	 * @return CubicCurve2D, c, the CubicCurve2D for the Graph
+	 * @return the CubicCurve2D for the Graph
 	 */
 	public CubicCurve2D buildCurve(Point p1, Point p2) {
 		x1 = (int) p1.getX();
@@ -585,11 +615,11 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * Fills the Arrays with booleans
+	 * Fills the Arrays with booleans.
 	 */
 	public void fillArrayofBooleans() {
 		for (int i = 0; i < arrayOfBooleans.length; i++) {
-			int t = (int) getYValueAt_2((int) (i * width / (model.getIterations() - 1)));
+			int t = (int) getYValueAt2((int) (i * width / (model.getIterations() - 1)));
 			if (t == 0) {
 				arrayOfBooleans[i] = true;
 			} else {
@@ -600,23 +630,24 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
-	 * Fills the Arrays of each HolonElement
+	 * Fills the Arrays of each HolonElement.
 	 */
 	@SuppressWarnings("unchecked")
 	public void fillArrayofValue() {
 		for (HolonElement he : tempElements) {
-			MAXIMUM = he.getEnergy();
+			maximum = he.getEnergy();
 			he.setGraphPoints((LinkedList<Point>) pointList.clone());
 			for (int i = 0; i < arrayOfFloats.length; i++) {
-				he.getEnergyAt()[i] = convertToValueY(getYValueAt_2((int) (i * width / (model.getIterations() - 1))));
+				he.getEnergyAt()[i] = convertToValueY(getYValueAt2((int) (i * width / (model.getIterations() - 1))));
 			}
 			arrayOfFloats = he.getEnergyAt();
 		}
 	}
 
 	/**
+	 * Get the Y Value at the x Coordination.
 	 * 
-	 * @param xVal,
+	 * @param xVal
 	 *            the x value for the y value
 	 * @return y, the value at x
 	 */
@@ -635,12 +666,13 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
+	 * Get y value at the x Coordination via curves.
 	 * 
-	 * @param xVal,
+	 * @param xVal
 	 *            the x value for the y value
-	 * @return y, the value at x
+	 * @return y value at x
 	 */
-	public float getYValueAt_2(int xVal) {
+	public float getYValueAt2(int xVal) {
 		for (int i = 0; i < pointList.size() - 1; i++) {
 			// get the Points
 			if (xVal >= pointList.get(i).getX()) {
@@ -687,10 +719,11 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	}
 
 	/**
+	 * Get the Intersection Point of 2 Lines.
 	 * 
-	 * @param l1,
+	 * @param l1
 	 *            the first Line
-	 * @param l2,
+	 * @param l2
 	 *            the second Line
 	 * 
 	 * @return The Intersection Point