*******************************************************************************/\r
package org.simantics.sysdyn.manager;\r
\r
+import java.io.BufferedReader;\r
import java.io.File;\r
import java.io.FileNotFoundException;\r
import java.io.IOException;\r
+import java.io.StringReader;\r
import java.util.ArrayList;\r
import java.util.Arrays;\r
import java.util.Collection;\r
}\r
\r
private boolean hasStructureChanged(String modelText, Map<String, String> inits) {\r
- if (!modelText.equals(previousModelStructure))\r
+ \r
+ \r
+ BufferedReader current = new BufferedReader(\r
+ new StringReader(modelText));\r
+ BufferedReader previous = new BufferedReader(\r
+ new StringReader(previousModelStructure));\r
+\r
+ String c, p;\r
+ try {\r
+ c = current.readLine();\r
+ p = previous.readLine();\r
+ \r
+ while (c != null && p != null) {\r
+ if(!c.equals(p)) {\r
+ if(c.contains("parameter") && p.contains("parameter")) {\r
+ int i = c.indexOf("=");\r
+ if(!c.substring(0, i).equals(p.substring(0, i))) {\r
+ // different parameter definition\r
+ return true;\r
+ }\r
+ } else {\r
+ // other than a line containing parameters differs\r
+ return true;\r
+ }\r
+ }\r
+ c = current.readLine();\r
+ p = previous.readLine();\r
+ }\r
+ \r
+ if((c == null && p != null) || (c != null && p == null)) {\r
+ // different lengths\r
+ return true;\r
+ }\r
+\r
+ } catch(IOException e) {\r
+ //e.printStackTrace();\r
return true;\r
+ }\r
+\r
for(String key : previousImportantInits.keySet()) {\r
if(!inits.containsKey(key) || !previousImportantInits.get(key).equals(inits.get(key)))\r
return true;\r