import org.simantics.db.service.XSupport;
import org.simantics.layer0.Layer0;
import org.simantics.operation.Layer0X;
-import org.simantics.spreadsheet.graph.SpreadsheetStyle.SpreadsheetStyleBuilder;
-import org.simantics.spreadsheet.graph.formula.SpreadsheetEvaluationEnvironment;
-import org.simantics.spreadsheet.graph.parser.SheetFormulaParser;
-import org.simantics.spreadsheet.graph.parser.ast.AstValue;
+import org.simantics.spreadsheet.Spreadsheets;
import org.simantics.spreadsheet.resource.SpreadsheetResource;
-import org.simantics.spreadsheet.util.SpreadsheetUtils;
+import org.simantics.spreadsheet.solver.SpreadsheetBook;
+import org.simantics.spreadsheet.solver.SpreadsheetStyle;
+import org.simantics.spreadsheet.solver.SpreadsheetStyle.SpreadsheetStyleBuilder;
+import org.simantics.spreadsheet.solver.formula.CellValueVisitor;
+import org.simantics.spreadsheet.solver.formula.SpreadsheetEvaluationEnvironment;
+import org.simantics.spreadsheet.solver.formula.parser.SheetFormulaParser;
+import org.simantics.spreadsheet.solver.formula.parser.ast.AstValue;
+import org.simantics.spreadsheet.synchronization.ExcelArrayFormula;
+import org.simantics.spreadsheet.synchronization.ExcelFormula;
import org.simantics.utils.DataContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
graph.claim(sheet, L0.ConsistsOf, L0.PartOf, newCell);
}
- BTree bt = new BTree(graph, SpreadsheetUtils.SPREADSHEET_BTREE_SIZE, SR.Lines, SR.LineNode, L0.PartOf, true);
+ BTree bt = new BTree(graph, Spreadsheets.SPREADSHEET_BTREE_SIZE, SR.Lines, SR.LineNode, L0.PartOf, true);
result.add(bt);
Resource lines = bt.rootOfBTree();
Cell val = row.getCell(i, Row.RETURN_BLANK_AS_NULL);
if(val != null) {
- String cellName = SpreadsheetUtils.cellName(rowN, i);
+ String cellName = Spreadsheets.cellName(rowN, i);
int ccIndx = val.getColumnIndex();
if(columnWidths.size()<=ccIndx){
} else if(Cell.CELL_TYPE_STRING == val.getCellType()) {
graph.claimLiteral(cell, SR.Cell_content, SR.Cell_content_Inverse, L0.Variant, Variant.ofInstance(val.toString()), Bindings.VARIANT);
} else if(Cell.CELL_TYPE_NUMERIC == val.getCellType()) {
- Double value = Double.parseDouble(val.toString());
- graph.claimLiteral(cell, SR.Cell_content, SR.Cell_content_Inverse, L0.Variant, Variant.ofInstance(value), Bindings.VARIANT);
+ try {
+ Double value = Double.parseDouble(val.toString());
+ graph.claimLiteral(cell, SR.Cell_content, SR.Cell_content_Inverse, L0.Variant, Variant.ofInstance(value), Bindings.VARIANT);
+ } catch (Exception e) {
+ graph.claimLiteral(cell, SR.Cell_content, SR.Cell_content_Inverse, L0.Variant, Variant.ofInstance(val.toString()), Bindings.VARIANT);
+ }
} else {
graph.claimLiteral(cell, SR.Cell_content, SR.Cell_content_Inverse, L0.Variant, Variant.ofInstance(val.toString()), Bindings.VARIANT);
System.err.println("Unprocessed cell type " + val.getCellType() + ", SheetName: " + sheetName + ", Row: " + rowN + ", Col:" + i);
SheetFormulaParser p = new SheetFormulaParser(new StringReader("(-(0.2/2)+SQRT((0.2/2)^2-4*((0.2/2)^2-(3*0.17625)/(PI()*4.7))))"));
AstValue v = p.relation();
System.err.println("v="+v);
- SpreadsheetBook book = new SpreadsheetBook();
+ SpreadsheetBook book = new SpreadsheetBook("http:/");
Object o = v.accept(new CellValueVisitor(SpreadsheetEvaluationEnvironment.getInstance(book), null));
System.err.println("o="+o);
}