|
@@ -115,7 +115,7 @@ public class MultiPurposeController {
|
|
|
public HolonElement searchEleById(HolonObject object, int idEle) {
|
|
|
return object.searchElementById(idEle);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
*
|
|
|
* @param upperNode
|
|
@@ -123,7 +123,7 @@ public class MultiPurposeController {
|
|
|
* @return
|
|
|
*/
|
|
|
public AbstractCpsObject searchIDUpperNode(CpsUpperNode upperNode, int id) {
|
|
|
-
|
|
|
+
|
|
|
Integer idx;
|
|
|
|
|
|
if ((idx = upperNode.getNodesIdx().get(id)) == null || upperNode.getNodesIdx().size() < 1)
|
|
@@ -176,6 +176,39 @@ public class MultiPurposeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * Adjust Indices before porting them from one map to another
|
|
|
+ *
|
|
|
+ * @param key
|
|
|
+ * the Key
|
|
|
+ * @param <T>
|
|
|
+ * key type
|
|
|
+ * @param map
|
|
|
+ * the Map
|
|
|
+ */
|
|
|
+ public <T> void adjustIdx(int x, HashMap<T, Integer> map) {
|
|
|
+
|
|
|
+ for (Entry<T, Integer> i : map.entrySet()) {
|
|
|
+ i.setValue(i.getValue() + x + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * Returns the highest Id
|
|
|
+ * @param map
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public <T> int getHighestIdx(HashMap<T, Integer> map) {
|
|
|
+ int max = 0;
|
|
|
+
|
|
|
+ for (T i : map.keySet()) {
|
|
|
+ if (map.get(i) > max)
|
|
|
+ max = map.get(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ return max;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* Copies a HashMap into a new One.
|
|
|
*
|