java.lang.Object
io.sf.carte.doc.style.css.property.Evaluator
io.sf.carte.doc.style.css.property.PercentageEvaluator
Evaluates expressions with only percentages and plain numbers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluate the given expression.evaluateFunction(CSSMathFunctionValue function) Evaluate the given mathematical function.protected floatpercentage(CSSNumberValue value, short resultType) Obtain the float value (in the requested absolute unit) corresponding to the given percentage value.Methods inherited from class io.sf.carte.doc.style.css.property.Evaluator
absoluteProxyValue, absoluteTypedValue, absoluteValue, anchorSize, createNumberValue, replaceParameter
-
Constructor Details
-
PercentageEvaluator
public PercentageEvaluator()
-
-
Method Details
-
evaluateExpression
Description copied from class:EvaluatorEvaluate the given expression.This method checks the result unit, assuming that the unit must match that of the returned primitive value (some functions may return values where the units are raised to a power greater than one, or lesser than zero).
- Overrides:
evaluateExpressionin classEvaluator- Parameters:
calc- the expression value to evaluate.- Returns:
- the result from evaluating the expression.
- Throws:
DOMException- if a problem was found evaluating the expression.
-
evaluateFunction
Description copied from class:EvaluatorEvaluate the given mathematical function.This method checks the result unit, assuming that the unit must match that of the returned primitive value (some functions may return values where the units are raised to a power greater than one, or lesser than zero).
- Overrides:
evaluateFunctionin classEvaluator- Parameters:
function- the mathematical function to evaluate.- Returns:
- the result of evaluating the function, or the function itself if this class does not know how to evaluate it.
- Throws:
DOMException- if a problem was found evaluating the function, or the resulting unit is not a valid CSS unit.
-
percentage
Obtain the float value (in the requested absolute unit) corresponding to the given percentage value.- Overrides:
percentagein classEvaluator- Parameters:
value- the percentage value.resultType- the desired absolute result type.- Returns:
- the absolute float value in the requested unit.
- Throws:
DOMException- if the percentage could not be converted to the requested unit.
-