]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/formula/SumFormulaFunction.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / src / org / simantics / spreadsheet / graph / formula / SumFormulaFunction.java
index 2163094e3777192f0ff5360862071d386bfac96c..299973db59329d0d56ea9dfff0e5f1251b4fbcc1 100644 (file)
@@ -1,36 +1,36 @@
-package org.simantics.spreadsheet.graph.formula;\r
-\r
-import org.simantics.spreadsheet.graph.CellFormulaFunction;\r
-import org.simantics.spreadsheet.graph.CellValueVisitor;\r
-import org.simantics.spreadsheet.graph.SpreadsheetGraphUtils;\r
-import org.simantics.spreadsheet.graph.SpreadsheetMatrix;\r
-import org.simantics.spreadsheet.graph.parser.ast.AstArgList;\r
-import org.simantics.spreadsheet.graph.parser.ast.AstValue;\r
-\r
-class SumFormulaFunction implements CellFormulaFunction<Object> {\r
-\r
-    @Override\r
-    public Object evaluate(CellValueVisitor visitor, AstArgList args) {\r
-        Double sum = 0.0;\r
-        for (AstValue value : args.values) {\r
-            Object result = value.accept(visitor);\r
-            \r
-            if (result instanceof SpreadsheetMatrix) {\r
-                Object value2 = ((SpreadsheetMatrix) result).sumWithFormulaError();\r
-                if(value2 instanceof String) return value2; //means sumWithFormulaError returned an Error message.\r
-                sum += ((Number)value2).doubleValue();\r
-            } else if(result instanceof String && !result.equals("")){\r
-               FormulaError2 error = FormulaError2.forString(result.toString());\r
-               if(error!=null) return error.getString();\r
-               Double v = SpreadsheetGraphUtils.asDoubleWhereEmptyStringIsZero(result);\r
-               if(v!=null)\r
-                       sum += v;\r
-            } else if(result instanceof Number){\r
-                sum += ((Number)result).doubleValue();\r
-            } else {\r
-                sum += SpreadsheetGraphUtils.asNumber(result);\r
-            }\r
-        }\r
-        return sum;\r
-    }\r
+package org.simantics.spreadsheet.graph.formula;
+
+import org.simantics.spreadsheet.graph.CellFormulaFunction;
+import org.simantics.spreadsheet.graph.CellValueVisitor;
+import org.simantics.spreadsheet.graph.SpreadsheetGraphUtils;
+import org.simantics.spreadsheet.graph.SpreadsheetMatrix;
+import org.simantics.spreadsheet.graph.parser.ast.AstArgList;
+import org.simantics.spreadsheet.graph.parser.ast.AstValue;
+
+class SumFormulaFunction implements CellFormulaFunction<Object> {
+
+    @Override
+    public Object evaluate(CellValueVisitor visitor, AstArgList args) {
+        Double sum = 0.0;
+        for (AstValue value : args.values) {
+            Object result = value.accept(visitor);
+            
+            if (result instanceof SpreadsheetMatrix) {
+                Object value2 = ((SpreadsheetMatrix) result).sumWithFormulaError();
+                if(value2 instanceof String) return value2; //means sumWithFormulaError returned an Error message.
+                sum += ((Number)value2).doubleValue();
+            } else if(result instanceof String && !result.equals("")){
+               FormulaError2 error = FormulaError2.forString(result.toString());
+               if(error!=null) return error.getString();
+               Double v = SpreadsheetGraphUtils.asDoubleWhereEmptyStringIsZero(result);
+               if(v!=null)
+                       sum += v;
+            } else if(result instanceof Number){
+                sum += ((Number)result).doubleValue();
+            } else {
+                sum += SpreadsheetGraphUtils.asNumber(result);
+            }
+        }
+        return sum;
+    }
 }
\ No newline at end of file