Package org.jxls.formula
Class AbstractFormulaProcessor
java.lang.Object
org.jxls.formula.AbstractFormulaProcessor
- All Implemented Interfaces:
FormulaProcessor
- Direct Known Subclasses:
FastFormulaProcessor,StandardFormulaProcessor
Partial implementation of
FormulaProcessor interface
It implements only some helper methods to allow their reuse for
FastFormulaProcessor and StandardFormulaProcessor-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildJointedCellRefMap(Transformer transformer, CellData formulaCellData) buildTargetCellRefMap(Transformer transformer, Area area, CellData formulaCellData) protected org.jxls.formula.AbstractFormulaProcessor.FormulaProcessorContextcreateFormulaProcessorContext(CellData formulaCellData, Transformer transformer, Area area) createTargetCellRefListByColumn(CellRef targetFormulaCellRef, List<CellRef> targetCells, List<CellRef> cellRefsToExclude) Creates a list of target formula cell referencesgetCellRefsFromJointedCellRef(String jointedCellRef) Parses a "jointed cell" reference and extracts individual cell referencesgetFormulaCellRefs(String formula) Parses a formula and returns a list of cell names used in it E.g.getJointedCellRefs(String formula) Parses a formula to extract a list of so called "jointed cells" The jointed cells are cells combined with a special notation "U_(cell1, cell2)" into a single cell They are used in formulas like this "$[SUM(U_(F8,F13))]".groupByColRange(List<CellRef> cellRefList) Groups a list of cell references in a column into a list of rangesgroupByRanges(List<CellRef> cellRefList, int targetRangeCount) Groups a list of cell references into a list ranges which can be used in a formula substitutiongroupByRowRange(List<CellRef> cellRefList) Groups a list of cell references in a row into a list of rangesprotected voidprocessTargetFormula(CellData formulaCellData, org.jxls.formula.AbstractFormulaProcessor.FormulaProcessorContext fpc) protected abstract voidprocessTargetFormulaCell(int i, CellData formulaCellData, org.jxls.formula.AbstractFormulaProcessor.FormulaProcessorContext fpc) protected voidprocessTargetFormulaCells(CellData formulaCellData, Transformer transformer, Area area) protected StringsheetNameRegex(Map.Entry<CellRef, List<CellRef>> cellRefEntry) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jxls.formula.FormulaProcessor
processAreaFormulas
-
Field Details
-
regexJointedLookBehind
- See Also:
-
regexCellRef
- See Also:
-
regexJointedCellRefPattern
-
regexExcludePrefixSymbols
- See Also:
-
-
Constructor Details
-
AbstractFormulaProcessor
public AbstractFormulaProcessor()
-
-
Method Details
-
buildTargetCellRefMap
-
buildJointedCellRefMap
-
getCellRefsFromJointedCellRef
Parses a "jointed cell" reference and extracts individual cell references- Parameters:
jointedCellRef- a jointed cell reference to parse- Returns:
- a list of cell names extracted from the jointed cell reference
-
getFormulaCellRefs
Parses a formula and returns a list of cell names used in it E.g. for formula "B4*(1+C4)" the returned list will contain "B4", "C4"- Parameters:
formula- string- Returns:
- a list of cell names used in the formula
-
getJointedCellRefs
Parses a formula to extract a list of so called "jointed cells" The jointed cells are cells combined with a special notation "U_(cell1, cell2)" into a single cell They are used in formulas like this "$[SUM(U_(F8,F13))]". Here the formula will use both F8 and F13 source cells to calculate the sum- Parameters:
formula- a formula string to parse- Returns:
- a list of jointed cells used in the formula
-
groupByRanges
Groups a list of cell references into a list ranges which can be used in a formula substitution- Parameters:
cellRefList- a list of cell referencestargetRangeCount- a number of ranges to use when grouping- Returns:
- a list of cell ranges grouped by row or by column
-
groupByColRange
Groups a list of cell references in a column into a list of ranges- Parameters:
cellRefList- -- Returns:
- a list of cell reference groups
-
groupByRowRange
Groups a list of cell references in a row into a list of ranges- Parameters:
cellRefList- -- Returns:
- -
-
sheetNameRegex
- Parameters:
cellRefEntry- -- Returns:
- the sheet name regular expression string
-
createTargetCellRefListByColumn
protected List<CellRef> createTargetCellRefListByColumn(CellRef targetFormulaCellRef, List<CellRef> targetCells, List<CellRef> cellRefsToExclude) Creates a list of target formula cell references- Parameters:
targetFormulaCellRef- -targetCells- -cellRefsToExclude- -- Returns:
- -
-
processTargetFormulaCells
protected void processTargetFormulaCells(CellData formulaCellData, Transformer transformer, Area area) -
processTargetFormulaCell
protected abstract void processTargetFormulaCell(int i, CellData formulaCellData, org.jxls.formula.AbstractFormulaProcessor.FormulaProcessorContext fpc) -
createFormulaProcessorContext
protected org.jxls.formula.AbstractFormulaProcessor.FormulaProcessorContext createFormulaProcessorContext(CellData formulaCellData, Transformer transformer, Area area) -
processTargetFormula
protected void processTargetFormula(CellData formulaCellData, org.jxls.formula.AbstractFormulaProcessor.FormulaProcessorContext fpc)
-