]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/EvaluateAll.java
First step to enable reading of cache when not writing
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / src / org / simantics / spreadsheet / graph / EvaluateAll.java
1 package org.simantics.spreadsheet.graph;
2
3 import org.simantics.spreadsheet.graph.formula.SpreadsheetEvaluationEnvironment;
4
5 public class EvaluateAll implements SpreadsheetVisitor {
6         
7         final SpreadsheetEvaluationEnvironment env;
8         
9         public EvaluateAll(SpreadsheetBook book) {
10                 this.env = SpreadsheetEvaluationEnvironment.getInstance(book);
11         }
12
13         @Override
14         public void visit(SpreadsheetBook book) {
15                 for(SpreadsheetEngine engine : book.sheets) engine.accept(this);
16         }
17
18         @Override
19         public void visit(SpreadsheetEngine engine) {
20                 engine.lines.accept(this);
21         }
22
23         @Override
24         public void visit(SpreadsheetLines node) {
25                 for(SpreadsheetLines child : node.nodes.values()) child.accept(this);
26                 for(SpreadsheetLine line : node.lines.values()) line.accept(this);
27         }
28
29         @Override
30         public void visit(SpreadsheetLine line) {
31                 for(SpreadsheetCell cell : line.cells) cell.accept(this);
32         }
33
34         @Override
35         public void visit(SpreadsheetCell cell) {
36                 try {
37                         cell.evaluate(env, null);
38                 } catch (Throwable t) {
39                         t.printStackTrace();
40                 }
41         }
42
43 }