]> gerrit.simantics Code Review - simantics/platform.git/blob
922b8af13d61db9b7258b78d6a44f3b322e134f9
[simantics/platform.git] /
1 package org.simantics.spreadsheet.graph.formula;
2
3 import org.simantics.spreadsheet.graph.CellFormulaFunction;
4 import org.simantics.spreadsheet.graph.CellValueVisitor;
5 import org.simantics.spreadsheet.graph.parser.ast.AstArgList;
6
7 public class IsErrorFormulaFunction implements CellFormulaFunction<Object>{
8
9         @Override
10     public Object evaluate(CellValueVisitor visitor, AstArgList args) {
11                 
12         if (args.values.size() != 1) throw new IllegalStateException();
13         
14         Object condition = args.values.get(0).accept(visitor);
15         if(condition instanceof String){
16                 FormulaError2 error = FormulaError2.forString((String)condition);
17                 return (error!=null);
18         }
19         return false;
20     }
21 }