Repository navigation
How Graph Builder Works in POI
The purpose of this document is to describe a GraphBuilder component, what problems it solves, how POI does a Cell evaluation and how this evaluation correlates to the algorithm of the GraphBuilder.
An object that represents a spreadsheet. Basic interface is IDataModel.java, implementation is DataModel.java. DataModel.java aggregates an instance of Apache POI’s XSSFWorkbook as private field. DataModel contains Cells with formulas and values. Any cell can be evaluated and so graph can be built for such cell.
An object that does the evaluation of DataModel\DataModel’s Cell. It responsibility is to provide a calculated value for given Cell or the whole DataModel. Basic interface is IEvaluator.java, implementation is SpreadsheetEvaluator.java. SpreadsheetEvaluator.java aggregates an instance of Apache POI’s XSSFFormulaEvaluator. This object is used to does evaluation of XSSFWorkbook’s cell.
An object that manages work of GraphBuilder and Evaluator at the same time. Its purpose is to inject the GraphBuilder instance to Evaluator and do some post processing operations on graph. This is also the start point to build a graph. Basic interface is IAuditor.java, implementation is SpreadsheetAuditor.java. Auditor requires an instance of Evaluator to be injected to work.
An object that does all the logic to build the actual execution graph. Its basic interface is IExecutionGraphBuilder.java from forked Apache POI library. Its methods like createVertex(), removeVertex(), connectVertices() are used to build graph (Directed graph with Vertex (as node) and Edge (as edge) is used). The only implementation is located in engine-evaluation library – PoiExecutionGraphBuilder.java. There is also an empty implementation of this interface – EmptyExecutionGraph$DoNothingExecutionGraphBuilder.java – this class with all empty method is used in POI evaluation algorithm when no graph recording is needed. PoiExecutionGraphBuilder is not thread safe and should be used in the only one instance of Auditor, since it does contain a state of a graph.
POI’s component to wrap WorkbookEvaluator and do evaluation.
POI’s component where all evaluation steps are performed. It operates with Ptg – a simple part of formula. Ptgs are key elements to build a graph.
An util object to resolve the actual Cell’s values. Contains several implementations for different purposes: OperandResolver.java, MultiOperandNumericFunction.java, Choose.java, etc.
The activity diagram of all components can be found here: PDF