freemarker.core
Class ArithmeticEngine
java.lang.Object
freemarker.core.ArithmeticEngine
public abstract class ArithmeticEngine
extends java.lang.Object
Class to perform arithmetic operations.
abstract Number | add(Number first, Number second)
|
abstract int | compareNumbers(Number first, Number second)
|
abstract Number | divide(Number first, Number second)
|
abstract Number | modulus(Number first, Number second)
|
abstract Number | multiply(Number first, Number second)
|
void | setMaxScale(int maxScale) - Sets the maximal scale to use when multiplying BigDecimal numbers.
|
void | setMinScale(int minScale) - Sets the minimal scale to use when dividing BigDecimal numbers.
|
void | setRoundingPolicy(int roundingPolicy)
|
abstract Number | subtract(Number first, Number second)
|
abstract Number | toNumber(String s)
|
BIGDECIMAL_ENGINE
public static final ArithmeticEngine.BigDecimalEngine BIGDECIMAL_ENGINE
Arithmetic engine that converts all numbers to BigDecimal
and
then operates on them. This is FreeMarker's default arithmetic engine.
CONSERVATIVE_ENGINE
public static final ArithmeticEngine.ConservativeEngine CONSERVATIVE_ENGINE
Arithmetic engine that uses (more-or-less) the widening conversions of
Java language to determine the type of result of operation, instead of
converting everything to BigDecimal up front.
maxScale
protected int maxScale
minScale
protected int minScale
roundingPolicy
protected int roundingPolicy
compareNumbers
public abstract int compareNumbers(Number first,
Number second)
throws TemplateException
divide
public abstract Number divide(Number first,
Number second)
throws TemplateException
modulus
public abstract Number modulus(Number first,
Number second)
throws TemplateException
multiply
public abstract Number multiply(Number first,
Number second)
throws TemplateException
setMaxScale
public void setMaxScale(int maxScale)
Sets the maximal scale to use when multiplying BigDecimal numbers.
Default value is 100.
setMinScale
public void setMinScale(int minScale)
Sets the minimal scale to use when dividing BigDecimal numbers. Default
value is 12.
setRoundingPolicy
public void setRoundingPolicy(int roundingPolicy)
subtract
public abstract Number subtract(Number first,
Number second)
throws TemplateException
toNumber
public abstract Number toNumber(String s)