1 package org.simantics.spreadsheet.graph.formula;
3 import org.simantics.spreadsheet.graph.CellFormulaFunction;
4 import org.simantics.spreadsheet.graph.CellValueVisitor;
5 import org.simantics.spreadsheet.graph.parser.ast.AstArgList;
7 public class IfErrorFormulaFunction implements CellFormulaFunction<Object> {
10 public Object evaluate(CellValueVisitor visitor, AstArgList args) {
12 if (args.values.size() != 2) throw new IllegalStateException();
14 Object condition = args.values.get(0).accept(visitor);
15 FormulaError2 error = FormulaError2.forObject(condition);
16 if(error!=null) return error.getString();
17 else return condition;