Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/updateInProgress' into XChart-integration

TomTroppmann 3 anni fa
parent
commit
e53f1b7715

+ 12 - 26
src/classes/HolonObject.java

@@ -4,6 +4,7 @@ package classes;
 import ui.controller.FlexManager;
 
 import java.util.ArrayList;
+import java.util.List;
 
 
 
@@ -16,7 +17,7 @@ import java.util.ArrayList;
  */
 public class HolonObject extends AbstractCanvasObject { 
     /* Array of all consumers */
-    private ArrayList<HolonElement> elements;
+    private List<HolonElement> elements = new ArrayList<HolonElement>();
     /* Array for tracking Production */
     private float[] trackingProd;
     /* Array for tracking Consumption */
@@ -32,7 +33,6 @@ public class HolonObject extends AbstractCanvasObject {
      */
     public HolonObject(String objName) {
         super(objName);
-        setElements(new ArrayList<>());
         setTrackingProd(new float[100]);
         setTrackingCons(new float[100]);
     }
@@ -42,9 +42,11 @@ public class HolonObject extends AbstractCanvasObject {
      *
      * @param obj object to be copied
      */
-    public HolonObject(AbstractCanvasObject obj) {
+    public HolonObject(HolonObject obj) {
         super(obj);
-        setElements(copyElements(((HolonObject) obj).getElements()));
+        for(HolonElement ele : obj.getElements()) {
+        	this.addElement(new HolonElement(ele));
+        }
         setTrackingProd(new float[100]);
         setTrackingCons(new float[100]);
     }
@@ -56,18 +58,10 @@ public class HolonObject extends AbstractCanvasObject {
      *
      * @return the elements ArrayList
      */
-    public ArrayList<HolonElement> getElements() {
+    public List<HolonElement> getElements() {
         return elements;
     }
 
-    /**
-     * Set a new ArrayList with HolonElements into the HolonObject.
-     *
-     * @param elements the elements to set
-     */
-    public void setElements(ArrayList<HolonElement> elements) {
-        this.elements = elements;
-    }
 
     /**
      * adds an Element to the Object.
@@ -76,6 +70,7 @@ public class HolonObject extends AbstractCanvasObject {
      */
     public void addElement(HolonElement element) {
         elements.add(element);
+        element.parentObject = this;
     }
 
     /**
@@ -110,19 +105,6 @@ public class HolonObject extends AbstractCanvasObject {
     }
 
 
-    /**
-     * Copy all Elements into a New Array.
-     *
-     * @param arr to copy
-     * @return the copy of arr
-     */
-    public ArrayList<HolonElement> copyElements(ArrayList<HolonElement> arr) {
-        ArrayList<HolonElement> newArr = new ArrayList<>();
-        for (HolonElement t : arr) {
-            newArr.add(new HolonElement(t));
-        }
-        return newArr;
-    }
 
 
     /**
@@ -376,4 +358,8 @@ public class HolonObject extends AbstractCanvasObject {
 	public int getNumberOfElements() {
 		return (int) elements.stream().count();
 	}
+
+	public void setElements(List<HolonElement> list) {
+		this.elements = list;
+	}
 }

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

@@ -1,6 +1,7 @@
 package ui.controller;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import classes.Category;
 import classes.AbstractCanvasObject;
@@ -153,15 +154,15 @@ public class CategoryController {
 	 *            Category
 	 * @param object
 	 *            New Object Name
-	 * @param elements
+	 * @param list
 	 *            Array of Elements
 	 * @param image
 	 *            the image Path
 	 */
-	public void addNewHolonObject(Category category, String object, ArrayList<HolonElement> elements, String image) {
+	public void addNewHolonObject(Category category, String object, List<HolonElement> list, String image) {
 		HolonObject obj = new HolonObject(object);
 		obj.setImage(image);
-		obj.setElements(elements);
+		obj.setElements(list);
 		obj.setSav(category.getName());
 		addObject(category, obj);
 	}

+ 4 - 3
src/ui/controller/Control.java

@@ -4,6 +4,7 @@ import java.awt.datatransfer.UnsupportedFlavorException;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.stream.Collectors;
 
 import javax.swing.JFrame;
@@ -215,12 +216,12 @@ public class Control {
      *
      * @param cat Category
      * @param obj New Object Name
-     * @param ele Array of Elements
+     * @param list Array of Elements
      * @param img the image Path
      * @throws IOException
      */
-    public void addObject(Category cat, String obj, ArrayList<HolonElement> ele, String img) throws IOException {
-        categoryController.addNewHolonObject(cat, obj, ele, img);
+    public void addObject(Category cat, String obj, List<HolonElement> list, String img) throws IOException {
+        categoryController.addNewHolonObject(cat, obj, list, img);
         saveCategory();
     }
 

+ 13 - 8
src/ui/controller/LoadController.java

@@ -258,11 +258,18 @@ public class LoadController {
      * @param eleDispatch 
      */
     private void loadCategoryElements(JsonElement jsonElement, HashMap<Integer, HolonElement> eleDispatch) {
-        HolonElement temp = model.getGson().fromJson(jsonElement.getAsJsonObject().get("properties").getAsJsonObject(),
-                HolonElement.class);
-        eleDispatch.put(temp.getId(), temp);
-        initElements(temp);
-        objC.addElementIntoCategoryObject(temp.getSaving().getKey(), temp.getSaving().getValue(), temp);
+        JsonObject object = jsonElement.getAsJsonObject();
+        HolonElement ele = model.getGson().fromJson(object.get("properties"), HolonElement.class); 
+        eleDispatch.put(ele.getId(), ele);
+        initElements(ele);
+        ele.flexList = model.getGson().fromJson(object.get("FlexList"), new TypeToken<List<Flexibility>>() {}.getType());
+        if(ele.flexList == null) ele.flexList = new ArrayList<Flexibility>();
+        ele.flexList.stream().forEach(flex -> {
+        	flex.setElement(ele);
+        	flex.constrainList.forEach(con -> con.fixJson());
+        	
+        });
+        objC.addElementIntoCategoryObject(ele.getSaving().getKey(), ele.getSaving().getValue(), ele);
     }
 
     /**
@@ -324,8 +331,7 @@ public class LoadController {
         HolonElement ele = model.getGson().fromJson(object.get("properties"), HolonElement.class);
         initElements(ele);
         ele.flexList = model.getGson().fromJson(object.get("FlexList"), new TypeToken<List<Flexibility>>() {}.getType());
-        //object.get("FlexList").getAsJsonArray().forEach(jo -> System.out.println("Hallo"));
-        //object.get("FlexList").getAsJsonArray().forEach(flexJson -> flexJson.getAsJsonObject().get("constrainList").getAsJsonArray().forEach(constrainJson -> System.out.println("Constrain:" + constrainJson.getAsJsonObject().get("name").getAsString())));
+        if(ele.flexList == null) ele.flexList = new ArrayList<>();
         ele.flexList.stream().forEach(flex -> {
         	flex.setElement(ele);
         	flex.constrainList.forEach(con -> con.fixJson());
@@ -362,7 +368,6 @@ public class LoadController {
      */
     private void loadUnitGraph(GRAPHTYPE type, JsonElement jsonElement, HashMap<Integer, AbstractCanvasObject> objDispatch,
                                HashMap<Integer, HolonElement> eleDispatch) {
-    	//TODO Make UnitGraph unterscheidung hinf�llig!!!!
         JsonObject object = jsonElement.getAsJsonObject();
         List<String> keys = getKeys(object);
         String p;

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

@@ -47,7 +47,7 @@ public class ObjectController {
      * @param element the Element
      */
     public void addElement(HolonObject object, HolonElement element) {
-        object.getElements().add(element);
+        object.addElement(element);
     }
 
     /**

+ 2 - 1
src/ui/model/DecoratedNetwork.java

@@ -298,7 +298,8 @@ public class DecoratedNetwork {
 		
 		return supplierList.stream().map(object -> object.getModel().getNumberOfElements()).reduce(0, Integer::sum)+
 				consumerList.stream().map(object -> object.getModel().getNumberOfElements()).reduce(0, Integer::sum)+
-				consumerSelfSuppliedList.stream().map(object -> object.getModel().getNumberOfElements()).reduce(0, Integer::sum);
+				consumerSelfSuppliedList.stream().map(object -> object.getModel().getNumberOfElements()).reduce(0, Integer::sum)+
+				passivNoEnergyList.stream().map(object -> object.getModel().getNumberOfElements()).reduce(0, Integer::sum);
 	}
 	
 	

+ 2 - 1
src/ui/view/AbstractCanvas.java

@@ -8,6 +8,7 @@ import java.awt.Image;
 import java.awt.Point;
 import java.awt.event.MouseEvent;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.TimerTask;
 
 import javax.swing.CellEditor;
@@ -75,7 +76,7 @@ public abstract class AbstractCanvas extends JPanel {
 	boolean toolTip; // Tooltip on or off
 	Vector2Int toolTipPos = new Vector2Int(); // Tooltip Position
 	String toolTipText = "";
-	ArrayList<HolonElement> dataSelected = new ArrayList<>();
+	List<HolonElement> dataSelected = new ArrayList<>();
 	ArrayList<AbstractCanvasObject> tempSelected = new ArrayList<>();
 	boolean[] showedInformation = new boolean[5];
 	boolean showConnectionInformation;

+ 4 - 25
src/ui/view/AddElementPopUp.java

@@ -26,7 +26,7 @@ public class AddElementPopUp extends JDialog {
 	private static final long serialVersionUID = 1L;
 	/* Data */
 	/** Holon Object the Element should be added to */
-	private AbstractCanvasObject tempCps;
+	private HolonObject tempCps;
 	/** Holon Element that should be edited (if in edit Modus */
 	private HolonElement hl;
 	
@@ -41,10 +41,6 @@ public class AddElementPopUp extends JDialog {
 	JCheckBox checkBoxActive;
 	/** Textfield to enter the amount of this Element */
 	private JTextField amount;
-	/** Textfield to enter the flexible Energy of the Element */
-	private JTextField flexibleEnergy;
-	/** Flexible if checkbox is checked */
-	JCheckBox checkboxFlexible;
 
 	/**
 	 * Create the AddElementPopup Dialog
@@ -103,21 +99,6 @@ public class AddElementPopUp extends JDialog {
 		checkBoxActive.setBounds(250, 50, 115, 20);
 		contentPanel.add(checkBoxActive);
 		
-		/* Add Flexible Energy Textfield and CheckBox */
-		JLabel lblFlexibleEnergy = new JLabel("Flexible Energy:");
-		lblFlexibleEnergy.setBounds(10, 90, 100, 20);
-		contentPanel.add(lblFlexibleEnergy);
-		
-		flexibleEnergy = new JTextField();
-		flexibleEnergy.setText("0");
-		flexibleEnergy.setColumns(10);
-		flexibleEnergy.setBounds(130, 90, 110, 20);
-		contentPanel.add(flexibleEnergy);
-		
-		checkboxFlexible = new JCheckBox("Flexible");
-		checkboxFlexible.setBounds(250, 90, 115, 20);
-		contentPanel.add(checkboxFlexible);
-		
 		/* Add Amount Textfield and Checkbox */
 		JLabel lblAmount = new JLabel("Amount:");
 		lblAmount.setBounds(10, 130, 100, 14);
@@ -152,7 +133,7 @@ public class AddElementPopUp extends JDialog {
 	 * @param cps
 	 *            actual Cps
 	 */
-	void setActualCps(AbstractCanvasObject cps) {
+	void setActualHolonObject(HolonObject cps) {
 		this.tempCps = cps;
 	}
 
@@ -183,7 +164,7 @@ public class AddElementPopUp extends JDialog {
 	 */
 	private void okAction() {
 		boolean repeated = false;
-		for (HolonElement e : ((HolonObject) tempCps).getElements()) {
+		for (HolonElement e :  tempCps.getElements()) {
 			if (elementName.getText().equals(e.getEleName())&&(hl == null || hl.getId()!=e.getId())) {
 				repeated = true;
 				break;
@@ -194,9 +175,7 @@ public class AddElementPopUp extends JDialog {
 				float energy = Float.parseFloat(providedEnergy.getText());
 				int elementAmount = Integer.parseInt(amount.getText());
 				if(hl == null){
-					//hl = new HolonElement(elementName.getText(), elementAmount, energy);
-					//should not happen
-					System.err.println("Undefined Element in 'AddElementPopUp'-class.");
+					hl = new HolonElement(this.tempCps, elementName.getText(), elementAmount, energy);
 				} else {
 					hl.setEleName(elementName.getText());
 					hl.setAmount(elementAmount);

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

@@ -167,7 +167,7 @@ public class AddObjectPopUp extends JDialog {
 			JButton btnAddDefaultElement = new JButton("Add Element");
 			btnAddDefaultElement.addActionListener(actionEvent -> {
                 addElement = new AddElementPopUp(parentFrame);
-                addElement.setActualCps(toEdit);
+                addElement.setActualHolonObject((HolonObject)toEdit);
 				addElement.setVisible(true);
 				HolonElement hl = addElement.getElement();
 				hl.setSaving(new Pair<>(givenCategory, objectName.getText()));

+ 2 - 2
src/ui/view/CreateTemplatePopUp.java

@@ -317,7 +317,7 @@ public class CreateTemplatePopUp extends JDialog {
 	 */
 	private void addElement() {
 		AddElementPopUp popUp = new AddElementPopUp(parent);
-		popUp.setActualCps(template);
+		popUp.setActualHolonObject(template);
 		popUp.setVisible(true);
 		HolonElement he = popUp.getElement();
 		if (he != null) {
@@ -348,7 +348,7 @@ public class CreateTemplatePopUp extends JDialog {
 			return;
 		
 		AddElementPopUp popUp = new AddElementPopUp(parent);
-		popUp.setActualCps(template);
+		popUp.setActualHolonObject(template);
 		popUp.setElement(template.getElements().get(index));
 		popUp.setVisible(true);
 		HolonElement he = popUp.getElement();

+ 4 - 3
src/ui/view/GUI.java

@@ -1022,7 +1022,7 @@ public class GUI{
 						&& tempCpsObject.getClass() == HolonObject.class
 						&& tempCpsObject.getId() != 0) {
 					addElementPopUp = new AddElementPopUp(holegJFrame);
-					addElementPopUp.setActualCps(updCon.getActualCps());
+					addElementPopUp.setActualHolonObject((HolonObject)updCon.getActualCps());
 					addElementPopUp.setVisible(true);
 					HolonElement ele = addElementPopUp.getElement();
 					if (ele != null) {
@@ -1537,7 +1537,7 @@ public class GUI{
 
 								AbstractCanvasObject h = null;
 								if (tempCps instanceof HolonObject) {
-									h = new HolonObject(tempCps);
+									h = new HolonObject((HolonObject)tempCps);
 								}
 								if (tempCps instanceof HolonSwitch) {
 									h = new HolonSwitch(tempCps);
@@ -1569,7 +1569,7 @@ public class GUI{
 
 							AbstractCanvasObject h = null;
 							if (tempCps instanceof HolonObject) {
-								h = new HolonObject(tempCps);
+								h = new HolonObject((HolonObject)tempCps);
 							}
 							if (tempCps instanceof HolonSwitch) {
 								h = new HolonSwitch(tempCps);
@@ -1916,6 +1916,7 @@ public class GUI{
 			canvas.repaint();
 			IdCounter.resetObjectCounter(CounterType.Object);
 			IdCounter.resetObjectCounter(CounterType.Element);
+			controller.calculateStateAndVisualForCurrentTimeStep();
 		});
 
 		mntmOpen.addActionListener(new ActionListener() {

+ 20 - 20
tests/tests/PraktikumHolonsTestCanvasController.java

@@ -50,13 +50,13 @@ public class PraktikumHolonsTestCanvasController {
 	public void testAddingObjects() {
 		// just adding a few things
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 0);
-		HolonObject a = new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant"));
+		HolonObject a = new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant"));
 		a.setPosition(100, 100);
 		controller.addNewObject(a);
 		assertTrue("ID of the Object does not Match", mp.searchByID(1).getName().equals("Power Plant"));
 		assertTrue("Type of the Object does not Match", mp.searchByID(1) instanceof HolonObject);
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 1);
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
 		/* trick drag&drop replace by moving a to 100 100 and then back to a, so
 		 * the rest of new objects won't know which one to replace
 		 */
@@ -64,27 +64,27 @@ public class PraktikumHolonsTestCanvasController {
 		assertTrue("ID of the Object does not Match", mp.searchByID(2).getName().equals("Power Plant"));
 		assertTrue("Type of the Object does not Match", mp.searchByID(2) instanceof HolonObject);
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 2);
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
 		assertTrue("ID of the Object does not Match", mp.searchByID(3).getName().equals("Power Plant"));
 		assertTrue("Type of the Object does not Match", mp.searchByID(3) instanceof HolonObject);
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 3);
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 4);
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 5);
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
 		assertTrue("ID of the Object does not Match", mp.searchByID(6).getName().equals("House"));
 		assertTrue("Type of the Object does not Match", mp.searchByID(6) instanceof HolonObject);
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 6);
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 7);
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 8);
-		controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
+		controller.addNewObject(new HolonSwitch((HolonObject)mp.searchCatObj(mp.searchCat("Component"), "Switch")));
 		assertTrue("ID of the Object does not Match", mp.searchByID(9).getName().equals("Switch"));
 		assertTrue("Type of the Object does not Match", mp.searchByID(9) instanceof HolonSwitch);
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 9);
-		controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
+		controller.addNewObject(new HolonSwitch((HolonObject)mp.searchCatObj(mp.searchCat("Component"), "Switch")));
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 10);
 	}
 	
@@ -94,16 +94,16 @@ public class PraktikumHolonsTestCanvasController {
 	@Test(expected = NullPointerException.class)
 	public void testDeletingObject() {
 		// Adding Objects on Canvas.. without Coordinates
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
-		controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
-		controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
-		controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
+		controller.addNewObject(new HolonSwitch((HolonObject)mp.searchCatObj(mp.searchCat("Component"), "Switch")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
+		controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
+		controller.addNewObject(new HolonSwitch((HolonObject)mp.searchCatObj(mp.searchCat("Component"), "Switch")));
 
 		controller.deleteObjectOnCanvas(mp.searchByID(4));
 		assertTrue("Object:4 was not deleted", mp.searchByID(4) == null);

+ 0 - 3
tests/tests/PraktikumHolonsTestClasses.java

@@ -71,9 +71,6 @@ public class PraktikumHolonsTestClasses {
 		assertTrue("String not corrent", str.equals("Element, Element"));
 		test2.deleteElement(0);
 		test2.addElement(ele);
-
-		assertTrue("Should be Empty", test3.getElements().isEmpty());
-		test3.setElements(test2.copyElements(test2.getElements()));
 		
 		assertTrue("Element not Found", test3.searchElement("Element") != null);
 		test1.setElements(new ArrayList<>());

+ 1 - 39
tests/tests/PraktikumHolonsTestObjectController.java

@@ -74,30 +74,6 @@ public class PraktikumHolonsTestObjectController {
 					((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House")).getElements().size() == 6 + i);
 		}
 
-//		controller.deleteElementInCategory("Building", "House", "B");
-//		controller.deleteElementInCategory("Building", "House", "D");
-//		controller.deleteElementInCategory("Building", "House", "F");
-//		controller.deleteElementInCategory("Building", "House", "G");
-//		controller.deleteElementInCategory("Building", "House", "H");
-//		controller.deleteElementInCategory("Building", "House", "I");
-//		controller.deleteElementInCategory("Building", "House", "Z");
-//		controller.deleteElementInCategory("Building", "House", "TV");
-//		assertTrue("Element:B was Found",
-//				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "B") == null);
-//		assertTrue("Element:D was Found",
-//				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "D") == null);
-//		assertTrue("Element:F was Found",
-//				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "F") == null);
-//		assertTrue("Element:G was Found",
-//				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "G") == null);
-//		assertTrue("Element:H was Found",
-//				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "H") == null);
-//		assertTrue("Element:I was Found",
-//				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "I") == null);
-//		assertTrue("Element:Z was Found",
-//				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "Z") == null);
-//		assertTrue("Element:TV was Found",
-//				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "TV") == null);
 	}
 
 	/**
@@ -106,22 +82,8 @@ public class PraktikumHolonsTestObjectController {
 	@Test
 	public void testAddingAndDeletingInCanvas() {
 		for (int i = 0; i < 100; i++) {
-			cvs.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
+			cvs.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
 		}
-//		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
-//			for (int i = 0; i < 27; i++) {
-//				controller.addNewElementIntoCanvasObject(cps.getId(), adapter.generate(i), 1, -100);
-//				assertTrue("Element:" + adapter.generate(i) + " was not Created",
-//						mp.searchEle((HolonObject) mp.searchByID(cps.getId()), adapter.generate(i)) != null);
-//			}
-//			assertTrue("Element:B was not Found", mp.searchEle((HolonObject) mp.searchByID(cps.getId()), "B") != null);
-//			assertTrue("Element:D was not Found", mp.searchEle((HolonObject) mp.searchByID(cps.getId()), "D") != null);
-//			assertTrue("Element:F was not Found", mp.searchEle((HolonObject) mp.searchByID(cps.getId()), "F") != null);
-//			assertTrue("Element:G was not Found", mp.searchEle((HolonObject) mp.searchByID(cps.getId()), "G") != null);
-//			assertTrue("Element:H was not Found", mp.searchEle((HolonObject) mp.searchByID(cps.getId()), "H") != null);
-//			assertTrue("Element:I was not Found", mp.searchEle((HolonObject) mp.searchByID(cps.getId()), "I") != null);
-//			assertTrue("Element:B was not Found", mp.searchEle((HolonObject) mp.searchByID(cps.getId()), "B") != null);
-//		}
 
 		for (AbstractCanvasObject cps : model.getObjectsOnCanvas()) {
 			int size = model.getSelectedCpsObjects().size();