|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfreemarker.core.ArithmeticEngine
public abstract class ArithmeticEngine
Class to perform arithmetic operations.
Nested Class Summary | |
---|---|
static class |
ArithmeticEngine.BigDecimalEngine
This is the default arithmetic engine in FreeMarker. |
static class |
ArithmeticEngine.ConservativeEngine
An arithmetic engine that conservatively widens the operation arguments to extent that they can hold the result of the operation. |
Field Summary | |
---|---|
static ArithmeticEngine.BigDecimalEngine |
BIGDECIMAL_ENGINE
Arithmetic engine that converts all numbers to BigDecimal and
then operates on them. |
static 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. |
protected int |
maxScale
|
protected int |
minScale
|
protected int |
roundingPolicy
|
Constructor Summary | |
---|---|
ArithmeticEngine()
|
Method Summary | |
---|---|
abstract java.lang.Number |
add(java.lang.Number first,
java.lang.Number second)
|
abstract int |
compareNumbers(java.lang.Number first,
java.lang.Number second)
|
abstract java.lang.Number |
divide(java.lang.Number first,
java.lang.Number second)
|
abstract java.lang.Number |
modulus(java.lang.Number first,
java.lang.Number second)
|
abstract java.lang.Number |
multiply(java.lang.Number first,
java.lang.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 java.lang.Number |
subtract(java.lang.Number first,
java.lang.Number second)
|
abstract java.lang.Number |
toNumber(java.lang.String s)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ArithmeticEngine.BigDecimalEngine BIGDECIMAL_ENGINE
BigDecimal
and
then operates on them. This is FreeMarker's default arithmetic engine.
public static final ArithmeticEngine.ConservativeEngine CONSERVATIVE_ENGINE
protected int minScale
protected int maxScale
protected int roundingPolicy
Constructor Detail |
---|
public ArithmeticEngine()
Method Detail |
---|
public abstract int compareNumbers(java.lang.Number first, java.lang.Number second) throws TemplateException
TemplateException
public abstract java.lang.Number add(java.lang.Number first, java.lang.Number second) throws TemplateException
TemplateException
public abstract java.lang.Number subtract(java.lang.Number first, java.lang.Number second) throws TemplateException
TemplateException
public abstract java.lang.Number multiply(java.lang.Number first, java.lang.Number second) throws TemplateException
TemplateException
public abstract java.lang.Number divide(java.lang.Number first, java.lang.Number second) throws TemplateException
TemplateException
public abstract java.lang.Number modulus(java.lang.Number first, java.lang.Number second) throws TemplateException
TemplateException
public abstract java.lang.Number toNumber(java.lang.String s)
public void setMinScale(int minScale)
public void setMaxScale(int maxScale)
public void setRoundingPolicy(int roundingPolicy)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |