]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Fixed the problem with multiple sheets. A return statement was called after the first...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 30 May 2012 10:04:10 +0000 (10:04 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 30 May 2012 10:04:10 +0000 (10:04 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25071 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Sheet.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/SheetFormatUtils.java

index 85331ac2a1c5d2bb660d02665e72a1bf9bcd3384..71a3b7563796eae4d6fb30404e6b878e18331ea3 100644 (file)
@@ -66,7 +66,7 @@ public class Sheet extends org.simantics.sysdyn.representation.Variable {
         final StringBuilder clazz = new StringBuilder();\r
         final HashSet<String> possibleRanges = new HashSet<String>();\r
 \r
-        clazz.append("    class " + name + "_class\n        ");\r
+        clazz.append("    class " + name + "_class\n");\r
         \r
         // Write all doubles that have been used in expressions\r
         int counter = 0;\r
@@ -83,7 +83,7 @@ public class Sheet extends org.simantics.sysdyn.representation.Variable {
 \r
                 if(value instanceof Double) {\r
                     Double d = (Double)value;\r
-                    clazz.append("constant Real " + key + " = " + d + "; ");\r
+                    clazz.append("        constant Real " + key + " = " + d + "; ");\r
                     counter++;\r
                     if(counter > 10) {\r
                         counter = 0;\r
@@ -116,7 +116,7 @@ public class Sheet extends org.simantics.sysdyn.representation.Variable {
                            \r
                             if(array[0].length > 1) {\r
                                 // Has two dimensions     \r
-                                clazz.append("constant Real[" + array.length + ", " + array[0].length + "] ");\r
+                                clazz.append("        constant Real[" + array.length + ", " + array[0].length + "] ");\r
                                 clazz.append(possibleRange.replace(":", "_") + " = {");\r
                                 for(int i = 0; i < array.length; i++) {\r
                                     clazz.append("{");\r
@@ -132,7 +132,7 @@ public class Sheet extends org.simantics.sysdyn.representation.Variable {
                                 clazz.append("};\n");\r
                             } else {\r
                                 // Has one dimension\r
-                                clazz.append("constant Real[" + array.length + "] ");\r
+                                clazz.append("        constant Real[" + array.length + "] ");\r
                                 clazz.append(possibleRange.replace(":", "_") + " = {");\r
                                 for(int i = 0; i < array.length; i++) {\r
                                     clazz.append(array[i][0]);\r
@@ -151,7 +151,7 @@ public class Sheet extends org.simantics.sysdyn.representation.Variable {
         }\r
         \r
         \r
-        clazz.append("\n    end " + name + "_class;\n");\r
+        clazz.append("    end " + name + "_class;\n");\r
         clazz.append("    " + name + "_class " + name + ";\n");\r
         return clazz.toString();\r
     }\r
index 0eb9f750011ea3b0b59a9f62474be9d0fc2feaf9..19b14ce88f186a3700574799319254e3520d72ae 100644 (file)
@@ -73,7 +73,7 @@ public class SheetFormatUtils {
                     String tmp = "";\r
                     int start = 0, end = 0, call = 0;\r
                     String cellOrRange = null;\r
-                    while((call = expression.indexOf(key, end)) >= 0) {\r
+                    while((call = expression.indexOf(key + "(", end)) >= 0) {\r
                         start = expression.indexOf("(", call);\r
                         \r
                         tmp += expression.substring(end, start);\r
@@ -101,7 +101,7 @@ public class SheetFormatUtils {
                         tmp += "." + cellOrRange;\r
                     }\r
                     tmp += expression.substring(end, expression.length());\r
-                    return tmp;\r
+                    expression = tmp;\r
                 }\r
             }\r
 \r