|
@@ -111,12 +111,12 @@ public class ObjectController {
|
|
|
|
|
|
/**
|
|
|
* deletes a Element from a given Canvas Object
|
|
|
- * @param obj
|
|
|
+ * @param ID
|
|
|
* @param ele
|
|
|
* @param amount
|
|
|
*/
|
|
|
- public void deleteElementInCanvas(String obj, String ele, int amount) {
|
|
|
- HolonObject object = searchHolonObject(obj, MODEL.getObjectsOnCanvas());
|
|
|
+ public void deleteElementInCanvas(int ID, String ele, int amount) {
|
|
|
+ HolonObject object = searchByID(ID, MODEL.getObjectsOnCanvas());
|
|
|
HolonElement element = searchHolonElement(object, ele);
|
|
|
|
|
|
element.setAmount(element.getAmount() - amount);
|
|
@@ -140,6 +140,20 @@ public class ObjectController {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Search for Object by ID
|
|
|
+ * @param ID
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public HolonObject searchByID(int ID, ArrayList<CpsObject> list){
|
|
|
+ for (CpsObject objects : list) {
|
|
|
+ if(objects.getID() == ID)
|
|
|
+ return (HolonObject) objects;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Search for Element
|
|
@@ -155,6 +169,8 @@ public class ObjectController {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Returns the ID of the selected Object 0 = no Object is selected
|