\r
public static void deleteIC(WriteGraph graph, Variable input, String name) throws DatabaseException {\r
graph.markUndoPoint();\r
- Resource model = Variables.getModel(graph, input);\r
- Resource child = Layer0Utils.getPossibleChild(graph, model, name);\r
- SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
-\r
- if((child != null) && graph.isInstanceOf(child, SYSDYN.InitialCondition))\r
- RemoverUtil.remove(graph, child);\r
- Layer0Utils.addCommentMetadata(graph, "Deleted Initial Condition " + graph.getRelatedValue2(child, Layer0.getInstance(graph).HasName, Bindings.STRING));\r
+ Resource model = Variables.getModel(graph, input);\r
+ Resource child = Layer0Utils.getPossibleChild(graph, model, name);\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
+\r
+ if((child != null) && graph.isInstanceOf(child, SYSDYN.InitialCondition)) {\r
+ // is it really necessary to fetch the name from the graph and not just use the provided name?\r
+ String actualName = graph.getRelatedValue2(child, L0.HasName, Bindings.STRING);\r
+ RemoverUtil.remove(graph, child);\r
+ Layer0Utils.addCommentMetadata(graph, "Deleted Initial Condition " + actualName);\r
+ }\r
}\r
\r
}\r