Przeglądaj źródła

Controller checkstyled

Kevin Trometer 7 lat temu
rodzic
commit
92da24be36

+ 7 - 7
src/tests/PraktikumHolonsTestLoadAndStoreController.java

@@ -191,7 +191,7 @@ public class PraktikumHolonsTestLoadAndStoreController {
 			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");
+			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
 			assertTrue("Same instance of Category:Building", building != mp.searchCat("Building")
@@ -201,14 +201,14 @@ public class PraktikumHolonsTestLoadAndStoreController {
 			// 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");
+			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
 			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")
@@ -235,7 +235,7 @@ public class PraktikumHolonsTestLoadAndStoreController {
 		try {
 			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");
+			loadController.readJson(path + "TestCanvasBasic.json");
 
 			assertTrue("NUmber of Objects on Canvas does not match", model.getObjectsOnCanvas().size() == 11);
 			for (AbstractCpsObject obj : model.getObjectsOnCanvas()) {
@@ -245,7 +245,7 @@ public class PraktikumHolonsTestLoadAndStoreController {
 
 			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");
+			loadController.readJson(path + "TestSavBasic.json");
 			assertTrue("NUmber of Categories not match", model.getCategories().size() == 29);
 			assertTrue("Existant Category dont Exists", mp.searchCat("J") != null);
 			assertTrue("Existant Category dont Exists", mp.searchCat("U") != null);
@@ -275,7 +275,7 @@ public class PraktikumHolonsTestLoadAndStoreController {
 		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");
+			loadController.readJson(path + "TestSavAdvanced.json");
 			assertTrue("Objects on Canvas is not 100", model.getObjectsOnCanvas().size() == 100);
 
 			int n = model.getObjectsOnCanvas().size();
@@ -295,7 +295,7 @@ public class PraktikumHolonsTestLoadAndStoreController {
 	@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");
+		loadController.readJson(path + "TestSavDummy.json");
 	}
 
 	/**

+ 29 - 9
src/ui/controller/AutoSaveController.java

@@ -1,28 +1,35 @@
 package ui.controller;
 
 import ui.model.Model;
+
 /**
+ * Autosave Controller.
  * 
- * @author krabs
- *
+ * @author Gruppe14
  */
 public class AutoSaveController {
-	private Model MODEL;
+	private Model model;
 	private int max = Integer.MAX_VALUE;
 	private int numberOfSaves = 20;
 	private int currentSave;
 	private int count = 0;
 	private boolean isAllowed = false;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            the Model
+	 */
 	public AutoSaveController(Model model) {
-		this.MODEL = model;
+		this.model = model;
 	}
 
 	/**
 	 * Increase the Auto save number.
 	 */
 	public void increaseAutoSaveNr() {
-		currentSave = MODEL.getAutoSaveNr() + 1;
+		currentSave = model.getAutoSaveNr() + 1;
 		if (count < currentSave) {
 			count = currentSave;
 		}
@@ -33,21 +40,34 @@ public class AutoSaveController {
 			currentSave = 0;
 		}
 
-		MODEL.setAutoSaveNr(currentSave);
+		model.setAutoSaveNr(currentSave);
 	}
 
+	/**
+	 * Decrease the Autosave Number.
+	 */
 	public void decreaseAutoSaveNr() {
-		currentSave = MODEL.getAutoSaveNr() - 1;
+		currentSave = model.getAutoSaveNr() - 1;
 		// if (currentSave < 0) {
 		// currentSave = max;
 		// }
-		MODEL.setAutoSaveNr(currentSave);
+		model.setAutoSaveNr(currentSave);
 	}
 
+	/**
+	 * Return the Autosave Number.
+	 * 
+	 * @return Autosave Number
+	 */
 	public int getAutoSaveNr() {
-		return MODEL.getAutoSaveNr();
+		return model.getAutoSaveNr();
 	}
 
+	/**
+	 * Return isAllowed.
+	 * 
+	 * @return isAllowed
+	 */
 	public boolean allowed() {
 		return isAllowed;
 	}

+ 56 - 37
src/ui/controller/CanvasController.java

@@ -13,13 +13,26 @@ import classes.HolonSwitch;
 import classes.Position;
 import ui.model.Model;
 
+/**
+ * Controller for the Canvas.
+ * 
+ * @author Gruppe14
+ */
 public class CanvasController {
 
-	private Model MODEL;
+	private Model model;
 	private MultiPurposeController mpC;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            the Model
+	 * @param mp
+	 *            the MultipurposeController
+	 */
 	public CanvasController(Model model, MultiPurposeController mp) {
-		this.MODEL = model;
+		this.model = model;
 		this.mpC = mp;
 	}
 
@@ -30,15 +43,16 @@ public class CanvasController {
 	 *            CpsObject to be added.
 	 */
 	public void addObject(AbstractCpsObject object) {
-		MODEL.getCvsObjIdx().put(object.getID(), MODEL.getObjectsOnCanvas().size());
-		MODEL.getObjectsOnCanvas().add(object);
+		model.getCvsObjIdx().put(object.getID(), model.getObjectsOnCanvas().size());
+		model.getObjectsOnCanvas().add(object);
 		notifyObjListeners();
 	}
 
 	/**
 	 * Add a new Object.
 	 * 
-	 * @param object the Object
+	 * @param object
+	 *            the Object
 	 */
 	public void addNewObject(AbstractCpsObject object) {
 		object.setSav("CVS");
@@ -46,40 +60,47 @@ public class CanvasController {
 		addObject(object);
 	}
 
+	/**
+	 * adds the ObjectListener.
+	 * 
+	 * @param objLis
+	 *            ObjectListener
+	 */
 	public void addObjectListener(ObjectListener objLis) {
-		MODEL.getObjectListeners().add(objLis);
+		model.getObjectListeners().add(objLis);
 	}
 
 	/**
-	 * notifies all listeners about changes in the Canvas
+	 * notifies all listeners about changes in the Canvas.
 	 */
 	public void notifyObjListeners() {
-		for (ObjectListener l : MODEL.getObjectListeners()) {
-			l.onChange(MODEL.getObjectsOnCanvas());
+		for (ObjectListener l : model.getObjectListeners()) {
+			l.onChange(model.getObjectsOnCanvas());
 		}
 	}
 
 	/**
 	 * Deletes an CpsObject on the Canvas and its connections.
 	 * 
-	 * @param obj AbstractCpsObject
+	 * @param obj
+	 *            AbstractCpsObject
 	 */
 	public void deleteObjectOnCanvas(AbstractCpsObject obj) {
 		CpsEdge e = null;
-		for (AbstractCpsObject cps : MODEL.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			for (CpsEdge p : cps.getConnections()) {
 				if (p.getA() == obj || p.getB() == obj) {
 					e = p;
 				}
 			}
-			if (!MODEL.getClipboradObjects().contains(cps)) {
+			if (!model.getClipboradObjects().contains(cps)) {
 				cps.getConnectedTo().remove(e);
 			}
-			MODEL.getEdgesOnCanvas().remove(e);
+			model.getEdgesOnCanvas().remove(e);
 		}
-		mpC.decIdx(obj.getID(), MODEL.getCvsObjIdx());
-		MODEL.getCvsObjIdx().remove(obj.getID());
-		MODEL.getObjectsOnCanvas().remove(obj);
+		mpC.decIdx(obj.getID(), model.getCvsObjIdx());
+		model.getCvsObjIdx().remove(obj.getID());
+		model.getObjectsOnCanvas().remove(obj);
 
 	}
 
@@ -90,7 +111,7 @@ public class CanvasController {
 	 *            the edge
 	 */
 	public void addEdgeOnCanvas(CpsEdge edge) {
-		MODEL.getEdgesOnCanvas().add(edge);
+		model.getEdgesOnCanvas().add(edge);
 	}
 
 	/**
@@ -102,17 +123,15 @@ public class CanvasController {
 	public void removeEdgesOnCanvas(CpsEdge edge) {
 		edge.getA().getConnections().remove(edge);
 		edge.getB().getConnections().remove(edge);
-		MODEL.getEdgesOnCanvas().remove(edge);
+		model.getEdgesOnCanvas().remove(edge);
 	}
 
-	
-	
 	/**
 	 * Copy all Selected Objects.
 	 */
 	@SuppressWarnings("unchecked")
 	public void copyObjects() {
-		MODEL.setClipboradObjects((ArrayList<AbstractCpsObject>) MODEL.getSelectedCpsObjects().clone());
+		model.setClipboradObjects((ArrayList<AbstractCpsObject>) model.getSelectedCpsObjects().clone());
 	}
 
 	/**
@@ -123,12 +142,12 @@ public class CanvasController {
 	 */
 	public void pasteObjects(Point p) {
 		System.out.println("paste");
-		MODEL.getSelectedCpsObjects().clear();
+		model.getSelectedCpsObjects().clear();
 		AbstractCpsObject tCps = null;
 		int x = Integer.MAX_VALUE, y = Integer.MAX_VALUE;
 
 		// Location whre to copy the Elements
-		for (AbstractCpsObject cps : MODEL.getClipboradObjects()) {
+		for (AbstractCpsObject cps : model.getClipboradObjects()) {
 			if (cps.getPosition().x < x) {
 				x = cps.getPosition().x;
 			}
@@ -140,7 +159,7 @@ public class CanvasController {
 		ArrayList<AbstractCpsObject> tempList = new ArrayList<>();
 
 		// Objects
-		for (AbstractCpsObject cps : MODEL.getClipboradObjects()) {
+		for (AbstractCpsObject cps : model.getClipboradObjects()) {
 			if (cps instanceof HolonObject) {
 				tCps = new HolonObject((HolonObject) cps);
 			} else if (cps instanceof HolonSwitch) {
@@ -156,24 +175,24 @@ public class CanvasController {
 
 		// Edges
 		boolean newEdge = true;
-		for (AbstractCpsObject cps : MODEL.getClipboradObjects()) {
+		for (AbstractCpsObject cps : model.getClipboradObjects()) {
 			System.out.println("Object edges: " + cps.getConnectedTo().size());
 			for (CpsEdge e : cps.getConnectedTo()) {
 				// A and B of e in the copied Elements?
-				if (MODEL.getClipboradObjects().indexOf(e.getA()) != -1
-						&& MODEL.getClipboradObjects().indexOf(e.getB()) != -1) {
-					AbstractCpsObject A = tempList.get(MODEL.getClipboradObjects().indexOf(e.getA()));
-					AbstractCpsObject B = tempList.get(MODEL.getClipboradObjects().indexOf(e.getB()));
+				if (model.getClipboradObjects().indexOf(e.getA()) != -1
+						&& 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?
-					for (CpsEdge et : tempList.get(MODEL.getClipboradObjects().indexOf(cps)).getConnectedTo()) {
+					for (CpsEdge et : tempList.get(model.getClipboradObjects().indexOf(cps)).getConnectedTo()) {
 						for (CpsEdge etA : et.getA().getConnectedTo()) {
-							if (et.getA() == A && et.getB() == B) {
+							if (et.getA() == a && et.getB() == b) {
 								System.out.println("false");
 								newEdge = false;
 							}
 						}
 						for (CpsEdge etB : et.getB().getConnectedTo()) {
-							if (et.getA() == A && et.getB() == B) {
+							if (et.getA() == a && et.getB() == b) {
 								System.out.println("false");
 								newEdge = false;
 							}
@@ -181,8 +200,8 @@ public class CanvasController {
 					}
 					if (newEdge) {
 						System.out.println("new edge");
-						CpsEdge tempE = new CpsEdge(tempList.get(MODEL.getClipboradObjects().indexOf(e.getA())), // A
-								tempList.get(MODEL.getClipboradObjects().indexOf(e.getB())), /* B */
+						CpsEdge tempE = new CpsEdge(tempList.get(model.getClipboradObjects().indexOf(e.getA())), // A
+								tempList.get(model.getClipboradObjects().indexOf(e.getB())), /* B */
 								e.getCapacity());
 						addEdgeOnCanvas(tempE);
 					}
@@ -198,12 +217,12 @@ public class CanvasController {
 	 */
 	@SuppressWarnings("unchecked")
 	public void cutObjects() {
-		MODEL.setClipboradObjects((ArrayList<AbstractCpsObject>) MODEL.getSelectedCpsObjects().clone());
+		model.setClipboradObjects((ArrayList<AbstractCpsObject>) model.getSelectedCpsObjects().clone());
 
-		for (AbstractCpsObject cps : MODEL.getClipboradObjects()) {
+		for (AbstractCpsObject cps : model.getClipboradObjects()) {
 			deleteObjectOnCanvas(cps);
 		}
 
-		MODEL.getSelectedCpsObjects().clear();
+		model.getSelectedCpsObjects().clear();
 	}
 }

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

@@ -11,12 +11,25 @@ import classes.HolonSwitch;
 import classes.HolonTransformer;
 import ui.model.Model;
 
+/**
+ * Controller for the Categories.
+ * 
+ * @author Gruppe14
+ */
 public class CategoryController {
-	private Model MODEL;
+	private Model model;
 	private MultiPurposeController mpC;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            the Model
+	 * @param mp
+	 *            the MultiPurposeController
+	 */
 	public CategoryController(Model model, MultiPurposeController mp) {
-		this.MODEL = model;
+		this.model = model;
 		this.mpC = mp;
 		initCategories();
 	}
@@ -39,10 +52,10 @@ public class CategoryController {
 
 	/**
 	 * Adds Category into Model if a Category with the same name already exists
-	 * Add Category_+1
+	 * Add Category_+1.
 	 * 
-	 * @param toAdd
-	 *            neue Kategorie
+	 * @param category
+	 *            the new Category
 	 */
 	public void addCategory(Category category) {
 		// int number = 0;
@@ -58,8 +71,8 @@ public class CategoryController {
 			category.setName(category.getName() + "_" + i);
 			i++;
 		}
-		MODEL.getCgIdx().put(category.getName(), MODEL.getCategories().size());
-		MODEL.getCategories().add(category);
+		model.getCgIdx().put(category.getName(), model.getCategories().size());
+		model.getCategories().add(category);
 		notifyCatListeners();
 	}
 
@@ -76,11 +89,14 @@ public class CategoryController {
 
 	/**
 	 * remove a Category from Model.
+	 * 
+	 * @param c
+	 *            Category
 	 */
 	public void removeCategory(Category c) {
-		mpC.decIdx(c.getName(), MODEL.getCgIdx());
-		MODEL.getCgIdx().remove(c.getName());
-		MODEL.getCategories().remove(c);
+		mpC.decIdx(c.getName(), model.getCgIdx());
+		model.getCgIdx().remove(c.getName());
+		model.getCategories().remove(c);
 
 		notifyCatListeners();
 	}
@@ -173,6 +189,11 @@ public class CategoryController {
 		addObject(cat, holonSwitch);
 	}
 
+	/**
+	 * Removes an Object from a Category.
+	 * @param category Category
+	 * @param cps the Object
+	 */
 	public void removeObject(Category category, AbstractCpsObject cps) {
 
 		mpC.decIdx(cps.getObjName(), category.getObjIdx());
@@ -202,15 +223,15 @@ public class CategoryController {
 	 *            the CategoryListener
 	 */
 	public void addCategoryListener(CategoryListener catLis) {
-		MODEL.getCategoryListeners().add(catLis);
+		model.getCategoryListeners().add(catLis);
 	}
 
 	/**
 	 * notifies all listeners about changes in the Categories.
 	 */
 	public void notifyCatListeners() {
-		for (CategoryListener l : MODEL.getCategoryListeners()) {
-			l.onChange(MODEL.getCategories());
+		for (CategoryListener l : model.getCategoryListeners()) {
+			l.onChange(model.getCategories());
 		}
 	}
 

+ 22 - 12
src/ui/controller/ConsoleController.java

@@ -8,16 +8,27 @@ import javax.swing.text.StyleConstants;
 import ui.model.Model;
 import ui.view.Console;
 
+/**
+ * Controller for the Canvas.
+ * 
+ * @author Gruppe14
+ */
 public class ConsoleController {
 
-	private Model MODEL;
+	private Model model;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            the Model
+	 */
 	public ConsoleController(Model model) {
-		this.MODEL = model;
+		this.model = model;
 	}
 
 	/**
-	 * Print Text on the console
+	 * Print Text on the console.
 	 *
 	 * @param text
 	 *            String the Text
@@ -29,29 +40,28 @@ public class ConsoleController {
 	 *            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) {
-		MODEL.getConsole().addText(text, color, p, bold, italic, nl);
+		model.getConsole().addText(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
 	 */
 	public void addTextToConsole(String text) {
-		MODEL.getConsole().addText(text);
+		model.getConsole().addText(text);
 	}
 
 	/**
-	 * Clears the console
+	 * Clears the console.
 	 */
 	public void clearConsole() {
-		MODEL.getConsole().clearConsole();
+		model.getConsole().clearConsole();
 	}
 }

+ 1 - 1
src/ui/controller/Control.java

@@ -451,7 +451,7 @@ public class Control {
 	 *             exception
 	 */
 	public void loadFile(String path) throws IOException {
-		loadController.readJSON(path);
+		loadController.readJson(path);
 	}
 
 	/**

+ 32 - 17
src/ui/controller/GlobalController.java

@@ -2,12 +2,23 @@ package ui.controller;
 
 import ui.model.Model;
 
+/**
+ * Controller for the Global Variables.
+ * 
+ * @author Gruppe14
+ */
 public class GlobalController {
 
-	private Model MODEL;
+	private Model model;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            the Model
+	 */
 	public GlobalController(Model model) {
-		this.MODEL = model;
+		this.model = model;
 	}
 
 	/**
@@ -16,7 +27,7 @@ public class GlobalController {
 	 * @return SCALE
 	 */
 	public int getScale() {
-		return MODEL.getScale();
+		return model.getScale();
 	}
 
 	/**
@@ -25,7 +36,7 @@ public class GlobalController {
 	 * @return SCALE Divided by 2
 	 */
 	public int getScaleDiv2() {
-		return MODEL.getScaleDiv2();
+		return model.getScaleDiv2();
 	}
 
 	/**
@@ -35,7 +46,7 @@ public class GlobalController {
 	 *            Scale
 	 */
 	public void setScale(int s) {
-		MODEL.setScale(s);
+		model.setScale(s);
 	}
 
 	/**
@@ -45,42 +56,46 @@ public class GlobalController {
 	 *            the current Iteration
 	 */
 	public void setCurIteration(int curit) {
-		MODEL.setCurIteration(curit);
+		model.setCurIteration(curit);
 	}
 
 	/**
-	 * Returns numberOfSaves
+	 * Returns numberOfSaves.
 	 * 
 	 * @return numberOfSaves
 	 */
 	public int getNumbersOfSaves() {
-		return MODEL.getNumberOfSaves();
+		return model.getNumberOfSaves();
 	}
 
 	/**
-	 * sets the max number of autosaves
+	 * sets the max number of autosaves.
 	 * 
-	 * @param numberOfSaves,
+	 * @param numberofSaves
 	 *            the max number of autosaves
 	 */
-	public void setNumberOfSaves(int numberOfSaves) {
-		MODEL.setNumberOfSaves(numberOfSaves);
+	public void setNumberOfSaves(int numberofSaves) {
+		model.setNumberOfSaves(numberofSaves);
 		;
 	}
 
 	/**
-	 * @return sets the timerSpeed
+	 * Set the timerSpeed.
+	 * @param t
+	 *            Interval in ms
 	 */
 	public void setTimerSpeed(int t) {
-		MODEL.setTimerSpeed(t);
+		model.setTimerSpeed(t);
 	}
-	
+
 	/**
-	 * @param isSimulation
+	 * Set isSimulation.
+	 * 
+	 * @param b
 	 *            boolean for for isSimulation
 	 */
 	public void setIsSimulation(boolean b) {
-		MODEL.setIsSimulation(b);
+		model.setIsSimulation(b);
 	}
 
 }

+ 66 - 30
src/ui/controller/LoadController.java

@@ -24,21 +24,42 @@ import classes.HolonTransformer;
 import classes.IdCounter;
 import ui.model.Model;
 
+/**
+ * Controller for the Loading.
+ * 
+ * @author Gruppe14
+ */
 public class LoadController {
-
-	public enum MODE {
+	/**
+	 * enum Mode.
+	 */
+	public enum Mode {
 		ALL, CATEGORY, CANVAS
 	}
 
-	private Model MODEL;
+	private Model model;
 	private CategoryController cgC;
 	private CanvasController cvsC;
 	private ObjectController objC;
 	private MultiPurposeController mpC;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            Model
+	 * @param cg
+	 *            CategoryController
+	 * @param cvs
+	 *            CanvasController
+	 * @param obj
+	 *            ObjectController
+	 * @param mp
+	 *            MultiPurposeController
+	 */
 	public LoadController(Model model, CategoryController cg, CanvasController cvs, ObjectController obj,
 			MultiPurposeController mp) {
-		this.MODEL = model;
+		this.model = model;
 		this.cgC = cg;
 		this.cvsC = cvs;
 		this.objC = obj;
@@ -49,17 +70,19 @@ public class LoadController {
 	/**
 	 * Reads the the JSON File and load the state into the Model.
 	 * 
-	 * @param path the Path
-	 * @throws IOException exception
+	 * @param path
+	 *            the Path
+	 * @throws IOException
+	 *             exception
 	 */
-	public void readJSON(String path) throws IOException {
+	public void readJson(String path) throws IOException {
 		JSONParser parser = new JSONParser();
 		JSONObject json = new JSONObject();
 		try {
 			json = (JSONObject) parser.parse(new FileReader(path));
-		} catch (ParseException e1) {
+		} catch (ParseException ex) {
 			// TODO Auto-generated catch block
-			e1.printStackTrace();
+			ex.printStackTrace();
 		}
 
 		ArrayList<String> obj = new ArrayList<>();
@@ -67,16 +90,16 @@ public class LoadController {
 		ArrayList<String> edge = new ArrayList<>();
 		ArrayList<String> gp = new ArrayList<>();
 
-		MODE mode = MODE.valueOf(json.get("MODE").toString());
+		Mode mode = Mode.valueOf(json.get("MODE").toString());
 
-		if (mode.equals(MODE.ALL) || mode.equals(MODE.CATEGORY)) {
-			MODEL.setCgIdx(new HashMap<String, Integer>());
-			MODEL.setCategories(new ArrayList<Category>());
+		if (mode.equals(Mode.ALL) || mode.equals(Mode.CATEGORY)) {
+			model.setCgIdx(new HashMap<String, Integer>());
+			model.setCategories(new ArrayList<Category>());
 		}
-		if (mode.equals(MODE.ALL) || mode.equals(MODE.CANVAS)) {
-			MODEL.setCvsObjIdx(new HashMap<Integer, Integer>());
-			MODEL.setObjectsOnCanvas(new ArrayList<AbstractCpsObject>());
-			MODEL.setEdgesOnCanvas(new ArrayList<CpsEdge>());
+		if (mode.equals(Mode.ALL) || mode.equals(Mode.CANVAS)) {
+			model.setCvsObjIdx(new HashMap<Integer, Integer>());
+			model.setObjectsOnCanvas(new ArrayList<AbstractCpsObject>());
+			model.setEdgesOnCanvas(new ArrayList<CpsEdge>());
 		}
 
 		for (Object key : json.keySet()) {
@@ -108,10 +131,12 @@ public class LoadController {
 	}
 
 	/**
-	 * dispatch the Keys into the right processing
+	 * dispatch the Keys into the right processing.
 	 * 
 	 * @param input
+	 *            input
 	 * @param json
+	 *            Json
 	 */
 	public void dispatch(ArrayList<String> input, JSONObject json) {
 
@@ -132,9 +157,10 @@ public class LoadController {
 	}
 
 	/**
-	 * Read all Categories from the JSON file
+	 * Read all Categories from the JSON file.
 	 * 
 	 * @param arr
+	 *            JSONArray
 	 */
 	public void readCategory(JSONArray arr) {
 
@@ -146,9 +172,10 @@ public class LoadController {
 	}
 
 	/**
-	 * Read all Objects in Category from the JSON File
+	 * Read all Objects in Category from the JSON File.
 	 * 
 	 * @param arr
+	 *            JSON Array
 	 */
 	public void readCategoryObject(JSONArray arr) {
 		Iterator<Object> i = arr.iterator();
@@ -166,9 +193,10 @@ public class LoadController {
 	}
 
 	/**
-	 * Read all Objects in Canvas from JSON File
+	 * Read all Objects in Canvas from JSON File.
 	 * 
 	 * @param arr
+	 *            JSON Array
 	 */
 	public void readCanvasObject(JSONArray arr) {
 		Iterator<Object> i = arr.iterator();
@@ -195,9 +223,10 @@ public class LoadController {
 	}
 
 	/**
-	 * Read all Elements in Category and Canvas from JSON File
+	 * Read all Elements in Category and Canvas from JSON File.
 	 * 
 	 * @param arr
+	 *            JSON Array
 	 */
 	public void readElement(JSONArray arr) {
 		Iterator<Object> i = arr.iterator();
@@ -215,8 +244,10 @@ public class LoadController {
 	}
 
 	/**
+	 * Read.
 	 * 
 	 * @param arr
+	 *            JSON Array
 	 */
 	public void readEdge(JSONArray arr) {
 		Iterator<Object> i = arr.iterator();
@@ -229,6 +260,12 @@ public class LoadController {
 		cvsC.addEdgeOnCanvas(edge);
 	}
 
+	/**
+	 * Read the Element Graph.
+	 * 
+	 * @param arr
+	 *            JSON Array
+	 */
 	public void readElementGraph(JSONArray arr) {
 		Iterator<Object> i = arr.iterator();
 
@@ -240,8 +277,7 @@ public class LoadController {
 			while (i.hasNext())
 				ele.getGraphPoints().add(new Point(Integer.parseInt(next(i)), Integer.parseInt(next(i))));
 		} else {
-			ele = mpC.searchEle((HolonObject) mpC.searchCatObj(mpC.searchCat(sav), next(i)),
-					next(i));
+			ele = mpC.searchEle((HolonObject) mpC.searchCatObj(mpC.searchCat(sav), next(i)), next(i));
 			while (i.hasNext())
 				ele.getGraphPoints().add(new Point(Integer.parseInt(next(i)), Integer.parseInt(next(i))));
 		}
@@ -249,20 +285,20 @@ public class LoadController {
 	}
 
 	/**
-	 * Get the Next Element from an Iterator
+	 * Get the Next Element from an Iterator.
 	 * 
-	 * @param i
-	 * @return
+	 * @param i Iterator
+	 * @return next Element from the Iterator
 	 */
 	public String next(Iterator<Object> i) {
 		return i.next().toString();
 	}
 
 	/**
-	 * converting saved Integers into Booleans
+	 * converting saved Integers into Booleans.
 	 * 
-	 * @param x
-	 * @return
+	 * @param x integer
+	 * @return boolean
 	 */
 	public boolean convert(int x) {
 		return x == 1 ? true : false;

+ 56 - 16
src/ui/controller/MultiPurposeController.java

@@ -10,12 +10,23 @@ import classes.HolonElement;
 import classes.HolonObject;
 import ui.model.Model;
 
+/**
+ * Controller for Multiple Purposes.
+ * 
+ * @author Gruppe14
+ */
 public class MultiPurposeController {
 
-	private Model MODEL;
+	private Model model;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            Model
+	 */
 	public MultiPurposeController(Model model) {
-		this.MODEL = model;
+		this.model = model;
 
 	}
 
@@ -30,10 +41,10 @@ public class MultiPurposeController {
 
 		Integer idx;
 
-		if ((idx = MODEL.getCgIdx().get(category)) == null || MODEL.getCgIdx().size() < 1)
+		if ((idx = model.getCgIdx().get(category)) == null || model.getCgIdx().size() < 1)
 			return null;
 		else
-			return MODEL.getCategories().get(idx);
+			return model.getCategories().get(idx);
 	}
 
 	/**
@@ -58,25 +69,28 @@ public class MultiPurposeController {
 	/**
 	 * Search for Object by ID.
 	 * 
-	 * @param id the ID of the Object
+	 * @param id
+	 *            the ID of the Object
 	 * @return the CpsObject
 	 */
 	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);
+			return model.getObjectsOnCanvas().get(idx);
 	}
 
 	/**
-	 * Search for Element
+	 * Search for Element.
 	 * 
 	 * @param object
+	 *            the Holon Object
 	 * @param element
-	 * @return
+	 *            name of the Element
+	 * @return the Holon Element
 	 */
 	public HolonElement searchEle(HolonObject object, String element) {
 
@@ -88,31 +102,54 @@ public class MultiPurposeController {
 			return object.getElements().get(idx);
 	}
 
+	/**
+	 * Search the Element by ID.
+	 * 
+	 * @param object
+	 *            the Holon Object
+	 * @param idEle
+	 *            the Element ID
+	 * @return The Holon Element
+	 */
 	public HolonElement searchEleById(HolonObject object, int idEle) {
 		return object.searchElementById(idEle);
 	}
 
+	/**
+	 * Search Edge between 2 Objects.
+	 * 
+	 * @param a
+	 *            ID of Object a
+	 * @param b
+	 *            ID of Object b
+	 * @return The Edge
+	 */
 	public CpsEdge searchEdge(int a, int b) {
 
-		AbstractCpsObject A = searchByID(a);
-		AbstractCpsObject B = searchByID(b);
+		AbstractCpsObject objA = searchByID(a);
+		AbstractCpsObject objB = searchByID(b);
 
-		for (CpsEdge edge : MODEL.getEdgesOnCanvas()) {
+		for (CpsEdge edge : model.getEdgesOnCanvas()) {
 			// if (edge.getA().getObjName().equals(A.getObjName()) &&
 			// (edge.getB().getObjName().equals(B.getObjName()))
 			// || edge.getB().getObjName().equals(A.getObjName())
 			// && (edge.getA().getObjName().equals(B.getObjName())))
-			if ((edge.getA().equals(A) && edge.getB().equals(B)) || (edge.getB().equals(A)) && edge.getA().equals(B))
+			if ((edge.getA().equals(objA) && edge.getB().equals(objB))
+					|| (edge.getB().equals(objA)) && edge.getA().equals(objB))
 				return edge;
 		}
 		return null;
 	}
 
 	/**
-	 * Decrement the Indices if a Key as been removed
+	 * Decrement the Indices if a Key as been removed.
 	 * 
 	 * @param key
+	 *            the Key
+	 * @param <T>
+	 *            key type
 	 * @param map
+	 *            the Map
 	 */
 	public <T> void decIdx(T key, HashMap<T, Integer> map) {
 
@@ -123,10 +160,13 @@ public class MultiPurposeController {
 	}
 
 	/**
-	 * Copies a HashMap into a new One
+	 * Copies a HashMap into a new One.
 	 * 
 	 * @param map
-	 * @return
+	 *            the HashMap
+	 * @param <T>
+	 *            type
+	 * @return Copy of the HashMap
 	 */
 	public static <T, Integer> HashMap<T, Integer> copyHashMap(HashMap<T, Integer> map) {
 

+ 52 - 19
src/ui/controller/ObjectController.java

@@ -8,19 +8,32 @@ import classes.HolonElement;
 import classes.HolonObject;
 import ui.model.Model;
 
+/**
+ * Controller for Objects.
+ * 
+ * @author Gruppe14
+ */
 public class ObjectController {
 
-	private Model MODEL;
+	private Model model;
 	private MultiPurposeController mpC;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            Model
+	 * @param mp
+	 *            MultiPurposeController
+	 */
 	public ObjectController(Model model, MultiPurposeController mp) {
-		this.MODEL = model;
+		this.model = model;
 		this.mpC = mp;
 		initHolonElements();
 	}
 
 	/**
-	 * init default Power supply of the Power Plant
+	 * init default Power supply of the Power Plant.
 	 */
 	public void initHolonElements() {
 		addNewElementIntoCategoryObject("Energy", "Power Plant", "Power", 1, 10000);
@@ -33,7 +46,12 @@ public class ObjectController {
 	}
 
 	/**
-	 * Adds Element into a Object
+	 * Adds Element into a Object.
+	 * 
+	 * @param object
+	 *            the Object
+	 * @param element
+	 *            the Element
 	 */
 	public void addElement(HolonObject object, HolonElement element) {
 		object.getEleIdx().put(element.getEleName(), object.getElements().size());
@@ -41,11 +59,12 @@ public class ObjectController {
 	}
 
 	/**
-	 * Adds Element into a Object on the Canvas
+	 * Adds Element into a Object on the Canvas.
 	 * 
 	 * @param object
+	 *            the Object
 	 * @param element
-	 * @param type
+	 *            the Element
 	 */
 	public void addElementIntoCanvasObject(HolonObject object, HolonElement element) {
 		element.setSav("CVS");
@@ -56,10 +75,14 @@ public class ObjectController {
 	/**
 	 * Add a new Element into a Object on the Canvas.
 	 * 
-	 * @param id the Object ID
-	 * @param element the Name of the Element
-	 * @param amount the Amount
-	 * @param energy the Energy
+	 * @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);
@@ -69,8 +92,13 @@ public class ObjectController {
 	/**
 	 * Add Element into a Object in Category.
 	 * 
+	 * @param category
+	 *            the Category
+	 * 
 	 * @param object
+	 *            the Object
 	 * @param element
+	 *            the Element
 	 */
 	public void addElementIntoCategoryObject(String category, String object, HolonElement element) {
 		element.setSav(category);
@@ -117,19 +145,21 @@ public class ObjectController {
 	/**
 	 * deletes a selectedObject.
 	 * 
-	 * @param obj Cpsobject
+	 * @param obj
+	 *            Cpsobject
 	 */
 	public void deleteSelectedObject(AbstractCpsObject obj) {
-		MODEL.getSelectedCpsObjects().remove(obj);
+		model.getSelectedCpsObjects().remove(obj);
 	}
 
 	/**
 	 * add an Object to selectedObject.
 	 * 
-	 * @param obj AbstractCpsobject
+	 * @param obj
+	 *            AbstractCpsobject
 	 */
 	public void addSelectedObject(AbstractCpsObject obj) {
-		MODEL.getSelectedCpsObjects().add(obj);
+		model.getSelectedCpsObjects().add(obj);
 	}
 
 	/**
@@ -149,12 +179,14 @@ public class ObjectController {
 	}
 
 	/**
-	 * deletes a Element from a given Category Object
+	 * deletes a Element from a given Category Object.
 	 * 
 	 * @param cat
+	 *            the Category
 	 * @param obj
+	 *            the Object
 	 * @param ele
-	 * @param amount
+	 *            the Element
 	 */
 	public void deleteElementInCategory(String cat, String obj, String ele) {
 		Category category = mpC.searchCat(cat);
@@ -167,10 +199,11 @@ public class ObjectController {
 	/**
 	 * Returns the ID of the selected Object 0 = no Object is selected.
 	 * 
-	 * @param id the ID of the selected Object
+	 * @param id
+	 *            the ID of the selected Object
 	 */
 	public void setSelectedObjectID(int id) {
-		MODEL.setSelectedObjectID(id);
+		model.setSelectedObjectID(id);
 	}
 
 	/**
@@ -180,6 +213,6 @@ public class ObjectController {
 	 *            of CpsObjects
 	 */
 	public void setClipboardObjects(ArrayList<AbstractCpsObject> list) {
-		MODEL.setClipboradObjects(list);
+		model.setClipboradObjects(list);
 	}
 }

+ 129 - 27
src/ui/controller/SimulationManager.java

@@ -13,6 +13,11 @@ import classes.SubNet;
 import ui.model.Model;
 import ui.view.MyCanvas;
 
+/**
+ * Controller for Simulation.
+ * 
+ * @author Gruppe14
+ */
 public class SimulationManager {
 	private Model model;
 	private ArrayList<AbstractCpsObject> objectsToHandle;
@@ -23,6 +28,12 @@ public class SimulationManager {
 	private boolean simMode;
 	private HashMap<Integer, Float> tagTable = new HashMap<Integer, Float>();
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param m
+	 *            Model
+	 */
 	public SimulationManager(Model m) {
 		canvas = null;
 		model = m;
@@ -33,14 +44,15 @@ public class SimulationManager {
 	/**
 	 * calculates the flow of the edges and the supply for objects.
 	 * 
-	 * @param x current Iteration
+	 * @param x
+	 *            current Iteration
 	 */
 	public void calculateStateForTimeStep(int x) {
 		simMode = model.getIsSimulation();
 		timeStep = x;
 		searchForSubNets();
 		for (SubNet singleSubNet : subNets) {
-			ResetConnections(singleSubNet.getObjects().get(0), new ArrayList<Integer>(), new ArrayList<CpsEdge>());
+			resetConnections(singleSubNet.getObjects().get(0), new ArrayList<Integer>(), new ArrayList<CpsEdge>());
 		}
 		for (SubNet singleSubNet : subNets) {
 			float production = calculateEnergy("prod", singleSubNet, timeStep);
@@ -79,6 +91,14 @@ public class SimulationManager {
 		canvas.repaint();
 	}
 
+	/**
+	 * Sets the Flow.
+	 * 
+	 * @param sN
+	 *            Subnet
+	 * @param simulation
+	 *            boolean if Simulation is on
+	 */
 	public void setFlow(SubNet sN, boolean simulation) {
 		if (simulation) {
 			setFlowSimulation(sN);
@@ -87,6 +107,12 @@ public class SimulationManager {
 		}
 	}
 
+	/**
+	 * set the Flow Modelation.
+	 * 
+	 * @param sN
+	 *            Subnet
+	 */
 	public void setFlowModelation(SubNet sN) {
 		for (HolonObject hl : sN.getObjects()) {
 			float energy = hl.getCurrentEnergyAtTimeStep(timeStep);
@@ -99,6 +125,12 @@ public class SimulationManager {
 		}
 	}
 
+	/**
+	 * Set Flow Simulation.
+	 * 
+	 * @param sN
+	 *            Subnet
+	 */
 	public void setFlowSimulation(SubNet sN) {
 		ArrayList<AbstractCpsObject> producers = new ArrayList<AbstractCpsObject>();
 		AbstractCpsObject tmp = null;
@@ -131,6 +163,14 @@ public class SimulationManager {
 		setFlowSimRec(producers, 0);
 	}
 
+	/**
+	 * Set Flow Rimulation Rec.
+	 * 
+	 * @param nodes
+	 *            the nodes
+	 * @param iter
+	 *            the Iteration
+	 */
 	public void setFlowSimRec(ArrayList<AbstractCpsObject> nodes, int iter) {
 		ArrayList<AbstractCpsObject> newNodes = new ArrayList<AbstractCpsObject>();
 		ArrayList<Integer> pseudoTags = new ArrayList<Integer>();
@@ -179,12 +219,24 @@ public class SimulationManager {
 		}
 	}
 
+	/**
+	 * Set the Pseudo Tags.
+	 * 
+	 * @param nodes
+	 *            Array of AbstractCpsObjects
+	 */
 	public void setPseudoTags(ArrayList<AbstractCpsObject> nodes) {
 		for (AbstractCpsObject node : nodes) {
 			node.setTags(node.getPseudoTags());
 		}
 	}
 
+	/**
+	 * Print the nodes.
+	 * 
+	 * @param nodes
+	 *            Array of AbstractCpsObject
+	 */
 	public void printNodes(ArrayList<AbstractCpsObject> nodes) {
 		System.out.println("new Nodes:");
 		for (AbstractCpsObject node : nodes) {
@@ -192,6 +244,13 @@ public class SimulationManager {
 		}
 	}
 
+	/**
+	 * Get String.
+	 * 
+	 * @param tags
+	 *            the tags
+	 * @return the String
+	 */
 	public String getString(ArrayList<Integer> tags) {
 		String result = "";
 		for (Integer i : tags) {
@@ -200,14 +259,23 @@ public class SimulationManager {
 		return result;
 	}
 
-	public ArrayList<Integer> mergeLists(ArrayList<Integer> A, ArrayList<Integer> B) {
+	/**
+	 * Merge the Lists.
+	 * 
+	 * @param a
+	 *            first liust
+	 * @param b
+	 *            second list
+	 * @return the Result
+	 */
+	public ArrayList<Integer> mergeLists(ArrayList<Integer> a, ArrayList<Integer> b) {
 		ArrayList<Integer> result = new ArrayList<Integer>();
-		for (Integer i : A) {
+		for (Integer i : a) {
 			if (!(result.contains(i))) {
 				result.add(i);
 			}
 		}
-		for (Integer j : B) {
+		for (Integer j : b) {
 			if (!(result.contains(j))) {
 				result.add(j);
 			}
@@ -215,7 +283,17 @@ public class SimulationManager {
 		return result;
 	}
 
-	public void ResetConnections(AbstractCpsObject cps, ArrayList<Integer> visitedObj,
+	/**
+	 * Reset the Connection.
+	 * 
+	 * @param cps
+	 *            CpsObject
+	 * @param visitedObj
+	 *            the visited Objects
+	 * @param visitedEdges
+	 *            the visited Edges
+	 */
+	public void resetConnections(AbstractCpsObject cps, ArrayList<Integer> visitedObj,
 			ArrayList<CpsEdge> visitedEdges) {
 		visitedObj.add(cps.getID());
 		cps.resetTags();
@@ -226,11 +304,11 @@ public class SimulationManager {
 				e.setTags(new ArrayList<Integer>());
 				visitedEdges.add(e);
 				if (!(visitedObj.contains(e.getA().getID()))) {
-					ResetConnections(e.getA(), visitedObj, visitedEdges);
+					resetConnections(e.getA(), visitedObj, visitedEdges);
 					e.getA().resetTags();
 				}
 				if (!(visitedObj.contains(e.getB().getID()))) {
-					ResetConnections(e.getB(), visitedObj, visitedEdges);
+					resetConnections(e.getB(), visitedObj, visitedEdges);
 					e.getB().resetTags();
 				}
 			}
@@ -238,11 +316,16 @@ public class SimulationManager {
 	}
 
 	/**
-	 * calculates the energy of either all producers or consumers
+	 * calculates the energy of either all producers or consumers.
 	 * 
 	 * @param type
+	 *            Type
 	 * @param sN
-	 * @return
+	 *            Subnet
+	 * @param x
+	 *            Integer
+	 * 
+	 * @return The Energy
 	 */
 	public float calculateEnergy(String type, SubNet sN, int x) {
 		float energy = 0;
@@ -266,6 +349,15 @@ public class SimulationManager {
 		return energy;
 	}
 
+	/**
+	 * Calculate the Minimum Energy.
+	 * 
+	 * @param sN
+	 *            Subnet
+	 * @param x
+	 *            Integer
+	 * @return the Calculated minimum Energy
+	 */
 	public float calculateMinimumEnergy(SubNet sN, int x) {
 		float min = 0;
 		float minElement = 0;
@@ -284,7 +376,7 @@ public class SimulationManager {
 	}
 
 	/**
-	 * generates all subNets from all objectsToHandle
+	 * generates all subNets from all objectsToHandle.
 	 */
 	public void searchForSubNets() {
 		subNets = new ArrayList<SubNet>();
@@ -309,12 +401,15 @@ public class SimulationManager {
 
 	/**
 	 * recursivly generates a subnet of all objects, that one specific object is
-	 * connected to
+	 * connected to.
 	 * 
 	 * @param cps
+	 *            AbstractCpsObject
 	 * @param visited
+	 *            visited Array of Integer
 	 * @param sN
-	 * @return
+	 *            Subnets
+	 * @return Subnet
 	 */
 	public SubNet buildSubNet(AbstractCpsObject cps, ArrayList<Integer> visited, SubNet sN) {
 		visited.add(cps.getID());
@@ -325,26 +420,33 @@ public class SimulationManager {
 			sN.getSwitches().add((HolonSwitch) cps);
 		}
 		removeFromToHandle(cps.getID());
-		AbstractCpsObject A;
-		AbstractCpsObject B;
+		AbstractCpsObject a;
+		AbstractCpsObject b;
 		for (CpsEdge edge : cps.getConnections()) {
-			A = edge.getA();
-			B = edge.getB();
+			a = edge.getA();
+			b = edge.getB();
 			if (!(cps instanceof HolonSwitch)) {
 				if (!(sN.getEdges().contains(edge))) {
 					sN.getEdges().add(edge);
 				}
 			}
-			if (!visited.contains(A.getID()) && legitState(A, cps)) {
-				sN = buildSubNet(A, visited, sN);
+			if (!visited.contains(a.getID()) && legitState(a, cps)) {
+				sN = buildSubNet(a, visited, sN);
 			}
-			if (!visited.contains(B.getID()) && legitState(B, cps)) {
-				sN = buildSubNet(B, visited, sN);
+			if (!visited.contains(b.getID()) && legitState(b, cps)) {
+				sN = buildSubNet(b, visited, sN);
 			}
 		}
 		return sN;
 	}
 
+	/**
+	 * is the Switch in a legitimate State.
+	 * 
+	 * @param neighbor AbstractCpsObject
+	 * @param current AbstractCpsObject
+	 * @return boolean
+	 */
 	public boolean legitState(AbstractCpsObject neighbor, AbstractCpsObject current) {
 		if (current instanceof HolonSwitch) {
 			if (((HolonSwitch) current).getState(timeStep)) {
@@ -363,9 +465,9 @@ public class SimulationManager {
 	}
 
 	/**
-	 * removes an Object that already has been handled with
+	 * removes an Object that already has been handled with.
 	 * 
-	 * @param id
+	 * @param id the Object ID
 	 */
 	public void removeFromToHandle(int id) {
 		for (int i = 0; i < objectsToHandle.size(); i++) {
@@ -376,7 +478,7 @@ public class SimulationManager {
 	}
 
 	/**
-	 * ensures that objectsToHandle only contains HolonObjects
+	 * ensures that objectsToHandle only contains HolonObjects.
 	 */
 	public void cleanObjectsToHandle() {
 		for (int i = 0; i < objectsToHandle.size(); i++) {
@@ -387,9 +489,9 @@ public class SimulationManager {
 	}
 
 	/**
-	 * copies the data of an array of Objects
+	 * copies the data of an array of Objects.
 	 * 
-	 * @param toCopy
+	 * @param toCopy the ArrayList of CpsObjects co Copy
 	 */
 	public void copyObjects(ArrayList<AbstractCpsObject> toCopy) {
 		objectsToHandle = new ArrayList<AbstractCpsObject>();
@@ -399,7 +501,7 @@ public class SimulationManager {
 	}
 
 	/**
-	 * Prints the Components auf all subnets
+	 * Prints the Components auf all subnets.
 	 */
 	public void printNet() {
 		for (int i = 0; i < subNets.size(); i++) {

+ 78 - 34
src/ui/controller/StoreController.java

@@ -18,21 +18,35 @@ import classes.HolonTransformer;
 import classes.IdCounter;
 import ui.model.Model;
 
+/**
+ * Controller for Storage.
+ * 
+ * @author Gruppe14
+ */
 public class StoreController {
 
-	private Model MODEL;
+	private Model model;
 
+	/**
+	 * Constructor.
+	 * 
+	 * @param model
+	 *            the Model
+	 */
 	public StoreController(Model model) {
-		this.MODEL = model;
+		this.model = model;
 
 	}
 
 	/**
 	 * Writes the current State of the Modelling into a JSON File which can be
 	 * loaded.
-	 * @param path the Path
 	 * 
-	 * @throws IOException exception
+	 * @param path
+	 *            the Path
+	 * 
+	 * @throws IOException
+	 *             exception
 	 */
 	public void writeSaveFile(String path) throws IOException {
 
@@ -55,18 +69,26 @@ public class StoreController {
 		writer.flush();
 		writer.close();
 	}
-	
+
+	/**
+	 * Write the Canvas File.
+	 * 
+	 * @param path
+	 *            the Path
+	 * @throws IOException
+	 *             Exception
+	 */
 	public void writeCanvasFile(String path) throws IOException {
-		
+
 		JSONObject json = new JSONObject();
-		
+
 		json.put("MODE", "CANVAS");
 		json.put("ID", IdCounter.getCounter());
 		writeCanvasObjects(json);
 		writeCanvasElements(json);
 		writeEdges(json);
 		writeElementGraph(json);
-		
+
 		FileWriter writer = new FileWriter(path);
 		writer.write(json.toJSONString());
 		getClass();
@@ -74,17 +96,25 @@ public class StoreController {
 		writer.flush();
 		writer.close();
 	}
-	
+
+	/**
+	 * Write the Category File.
+	 * 
+	 * @param path
+	 *            the Path
+	 * @throws IOException
+	 *             exception
+	 */
 	public void writeCategoryFile(String path) throws IOException {
-		
+
 		JSONObject json = new JSONObject();
-		
+
 		json.put("MODE", "CATEGORY");
-		//eventuell muss man ID auch Speichern
+		// eventuell muss man ID auch Speichern
 		writeCategory(json);
 		writeCategoryObjects(json);
 		writeCategoryElements(json);
-		
+
 		FileWriter writer = new FileWriter(path);
 		writer.write(json.toJSONString());
 		getClass();
@@ -94,31 +124,34 @@ public class StoreController {
 	}
 
 	/**
-	 * writes all Categories into a JSONObject
+	 * writes all Categories into a JSONObject.
 	 * 
 	 * @param json
+	 *            JSON Object
 	 * @throws IOException
+	 *             exception
 	 */
 	public void writeCategory(JSONObject json) {
 		JSONArray arr = new JSONArray();
 
-		for (Category cat : MODEL.getCategories())
+		for (Category cat : model.getCategories())
 			arr.add(cat.getName());
 
 		json.put("CG", arr);
 	}
 
 	/**
-	 * writes all Objects in Category into a JSONObject
+	 * writes all Objects in Category into a JSONObject.
 	 * 
 	 * @param json
+	 *            JSON Object
 	 */
 	public void writeCategoryObjects(JSONObject json) {
 
 		JSONArray arr = new JSONArray();
 		int i = 1;
 
-		for (Category cats : MODEL.getCategories())
+		for (Category cats : model.getCategories())
 			for (AbstractCpsObject cps : cats.getObjects()) {
 				arr.add(getObjectType(cps));
 				arr.add(cps.getSav());
@@ -129,11 +162,17 @@ public class StoreController {
 			}
 	}
 
+	/**
+	 * Wrte Canvas Objects.
+	 * 
+	 * @param json
+	 *            JSON Object
+	 */
 	public void writeCanvasObjects(JSONObject json) {
 
 		JSONArray arr = new JSONArray();
 		int i = 1;
-		for (AbstractCpsObject cps : MODEL.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			arr.add(getObjectType(cps));
 			arr.add(cps.getObjName());
 			arr.add(cps.getName());
@@ -147,16 +186,17 @@ public class StoreController {
 	}
 
 	/**
-	 * writes all Elements in Objects in Category into a JSONObject
+	 * writes all Elements in Objects in Category into a JSONObject.
 	 * 
 	 * @param json
+	 *            JSON Object
 	 */
 	public void writeCategoryElements(JSONObject json) {
 
 		JSONArray arr = new JSONArray();
 		int i = 1;
 
-		for (Category cats : MODEL.getCategories())
+		for (Category cats : model.getCategories())
 			for (AbstractCpsObject cps : cats.getObjects())
 				if (cps instanceof HolonObject)
 					for (HolonElement ele : ((HolonObject) cps).getElements()) {
@@ -169,14 +209,18 @@ public class StoreController {
 						arr = new JSONArray();
 					}
 
-		
 	}
-	
+
+	/**
+	 * Write Canvas Elements.
+	 * 
+	 * @param json JSON Objects
+	 */
 	public void writeCanvasElements(JSONObject json) {
-		
+
 		JSONArray arr = new JSONArray();
 		int i = 1;
-		for (AbstractCpsObject cps : MODEL.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			if (cps instanceof HolonObject)
 				for (HolonElement ele : ((HolonObject) cps).getElements()) {
 					arr.add(ele.getSav());
@@ -192,16 +236,16 @@ public class StoreController {
 	}
 
 	/**
-	 * write all Edges into a JSONObject
+	 * write all Edges into a JSONObject.
 	 * 
-	 * @param json
+	 * @param json JSON Object
 	 */
 	public void writeEdges(JSONObject json) {
 
 		JSONArray arr = new JSONArray();
 		int i = 1;
 
-		for (CpsEdge edge : MODEL.getEdgesOnCanvas()) {
+		for (CpsEdge edge : model.getEdgesOnCanvas()) {
 			arr.add(edge.getA().getID());
 			arr.add(edge.getB().getID());
 			arr.add(edge.getCapacity());
@@ -212,9 +256,9 @@ public class StoreController {
 	}
 
 	/**
-	 * writes the Graph from all Elements into a JSONObject
+	 * writes the Graph from all Elements into a JSONObject.
 	 * 
-	 * @param json
+	 * @param json JSON Object
 	 */
 	public void writeElementGraph(JSONObject json) {
 
@@ -222,7 +266,7 @@ public class StoreController {
 		JSONArray arr = new JSONArray();
 		int i = 1;
 
-		for (Category cats : MODEL.getCategories())
+		for (Category cats : model.getCategories())
 			for (AbstractCpsObject cps : cats.getObjects())
 				if (cps instanceof HolonObject)
 					for (HolonElement ele : ((HolonObject) cps).getElements())
@@ -242,7 +286,7 @@ public class StoreController {
 							arr = new JSONArray();
 						}
 		i = 1;
-		for (AbstractCpsObject cps : MODEL.getObjectsOnCanvas()) {
+		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			if (cps instanceof HolonObject)
 				for (HolonElement ele : ((HolonObject) cps).getElements())
 					if (!ele.getGraphPoints().isEmpty()) {
@@ -264,10 +308,10 @@ public class StoreController {
 	}
 
 	/**
-	 * Return the Object Type
+	 * Return the Object Type.
 	 * 
-	 * @param cps
-	 * @return
+	 * @param cps AbstractCpsObject
+	 * @return The Object Type
 	 */
 	public String getObjectType(AbstractCpsObject cps) {
 		if (cps instanceof HolonObject)