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
\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
\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
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
}\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
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
tmp += "." + cellOrRange;\r
}\r
tmp += expression.substring(end, expression.length());\r
- return tmp;\r
+ expression = tmp;\r
}\r
}\r
\r