Class FormulaUtil
- java.lang.Object
-
- org.pentaho.reporting.libraries.formula.util.FormulaUtil
-
public class FormulaUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcreateCellUITextFromFormula(String formula)static StringcreateCellUITextFromFormula(String formula, FormulaContext context)static StringcreateEditorTextFromFormula(String formula, FormulaContext formulaContext)static StringcreateFormulaFromUIText(String formula)Creates a formula fragment from the given UI text.static StringextractFormula(String formula)static String[]extractFormulaContext(String formula)static StringextractStaticTextFromFormula(String formula)static StringextractStaticTextFromFormulaFragment(String formula)static String[]getReferences(String formula)static String[]getReferences(Formula formula)static booleanisValidFormulaFragment(String formula)static StringquoteReference(String reference)static StringquoteString(String text)
-
-
-
Method Detail
-
getReferences
public static String[] getReferences(String formula) throws ParseException
- Throws:
ParseException
-
extractStaticTextFromFormulaFragment
public static String extractStaticTextFromFormulaFragment(String formula)
-
isValidFormulaFragment
public static boolean isValidFormulaFragment(String formula)
-
createCellUITextFromFormula
public static String createCellUITextFromFormula(String formula, FormulaContext context)
-
createEditorTextFromFormula
public static String createEditorTextFromFormula(String formula, FormulaContext formulaContext)
-
createFormulaFromUIText
public static String createFormulaFromUIText(String formula)
Creates a formula fragment from the given UI text. Within the reporting engine, the fragment must be prefixed with a formula-context selector. The input follows the Excel/OpenOffice Calc rules: A leading equals indicates a formula, a leading apostrophe indicates a text. Otherwise, if the input is parsable as number it will be formed into a formula that returns that static number, and everything else will be treated as text. Note that there is no syntax check for formula input - if the user writes garbage after the formula selector, this garbage will still be treated as formula.- Parameters:
formula- the input from the user.- Returns:
- the normalized formula.
-
-