Class AbstractMathFunction
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.formula.function.AbstractFunction
-
- org.eclipse.nebula.widgets.nattable.formula.function.AbstractMathFunction
-
- All Implemented Interfaces:
FunctionValue
,OperatorFunctionValue
- Direct Known Subclasses:
AbstractMathSingleValueFunction
,ModFunction
,PowerFunction
,ProductFunction
,QuotientFunction
,SumFunction
public abstract class AbstractMathFunction extends AbstractFunction
Subclass of this class are intended to perform mathematical operations on the values set to it. It supports conversion of values toBigDecimal
and ensures that only validFunctionValue
s are accepted.- Since:
- 1.4
-
-
Field Summary
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.formula.function.AbstractFunction
values
-
-
Constructor Summary
Constructors Constructor Description AbstractMathFunction()
AbstractMathFunction(List<FunctionValue> values)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFunctionValue(FunctionValue value)
Add the givenFunctionValue
for calculation.protected BigDecimal
convertValue(Object value)
Converts a given value to aBigDecimal
.protected void
validateMethodParameter(List<FunctionValue> values)
Performs a type check for the given list ofFunctionValue
s and throws aFunctionException
in case aStringFunctionValue
is contained.-
Methods inherited from class org.eclipse.nebula.widgets.nattable.formula.function.AbstractFunction
isEmpty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.formula.function.FunctionValue
getValue
-
-
-
-
Constructor Detail
-
AbstractMathFunction
public AbstractMathFunction()
-
AbstractMathFunction
public AbstractMathFunction(List<FunctionValue> values)
-
-
Method Detail
-
addFunctionValue
public void addFunctionValue(FunctionValue value)
Description copied from interface:OperatorFunctionValue
Add the givenFunctionValue
for calculation.- Specified by:
addFunctionValue
in interfaceOperatorFunctionValue
- Overrides:
addFunctionValue
in classAbstractFunction
- Parameters:
value
- The value to add.
-
convertValue
protected BigDecimal convertValue(Object value)
Converts a given value to aBigDecimal
.- Parameters:
value
- The object to convert.- Returns:
- The
BigDecimal
representation of the given object. - Throws:
NumberFormatException
- is the given value can not be converted to aBigDecimal
-
validateMethodParameter
protected void validateMethodParameter(List<FunctionValue> values)
Performs a type check for the given list ofFunctionValue
s and throws aFunctionException
in case aStringFunctionValue
is contained.- Parameters:
values
- The list ofFunctionValue
that should be checked.- Throws:
FunctionException
- if aStringFunctionValue
is detected.
-
-