Class MulExpression
- java.lang.Object
-
- org.vedantatree.expressionoasis.expressions.UnaryOperatorExpression
-
- de.fzi.power.interpreter.calculator.expressionoasis.custom.expressions.MulExpression
-
- All Implemented Interfaces:
Expression
public class MulExpression extends UnaryOperatorExpression
Implementation of the(*)
fold operation: All elements of the processed collection are multiplied by each other,1
is returned in case the collection is empty.
Within expressions, this function can be used byMUL(collection)
.
-
-
Constructor Summary
Constructors Constructor Description MulExpression()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression
getOperandExpression()
Gets the operand expression for this unary operatorType
getReturnType()
Gets the return type of the expression.ValueObject
getValue()
Evaluates the expression, that is, the corresponding fold operation is executed.void
initialize(ExpressionContext expressionContext, Object parameters, boolean validate)
Initializes the operand expression.protected void
validate(ExpressionContext context)
Validates the expression.-
Methods inherited from class org.vedantatree.expressionoasis.expressions.UnaryOperatorExpression
accept, addTypePair, toString, uninitialize
-
-
-
-
Method Detail
-
getReturnType
public Type getReturnType()
Description copied from interface:Expression
Gets the return type of the expression.- Specified by:
getReturnType
in interfaceExpression
- Overrides:
getReturnType
in classUnaryOperatorExpression
- Returns:
Type.DOUBLE
.- See Also:
Expression.getReturnType()
-
getValue
public final ValueObject getValue() throws ExpressionEngineException
Evaluates the expression, that is, the corresponding fold operation is executed.- Returns:
- A
ValueObject
ofType.DOUBLE
that contains the result of the fold operation. - Throws:
ExpressionEngineException
- if there is any problem during execution
-
initialize
public void initialize(ExpressionContext expressionContext, Object parameters, boolean validate) throws ExpressionEngineException
Description copied from class:UnaryOperatorExpression
Initializes the operand expression.- Specified by:
initialize
in interfaceExpression
- Overrides:
initialize
in classUnaryOperatorExpression
- Parameters:
expressionContext
- contextual information, may help in initializationparameters
- for example, sub expressions and identifiers- Throws:
AssertionError
- In case the given expression context is not aCustomExpressionContext
instance.ExpressionEngineException
- if there is any problem during execution- See Also:
org.vedantatree.expressionoasis.expressions.Expression#initialize(org.vedantatree.expressionoasis.ExpressionContext, java.lang.Object)
-
validate
protected void validate(ExpressionContext context) throws ExpressionEngineException
Description copied from class:UnaryOperatorExpression
Validates the expression.- Overrides:
validate
in classUnaryOperatorExpression
- Throws:
AssertionError
- In case the given expression context is not aCustomExpressionContext
instance.ExpressionEngineException
- In case the operand does not contain any measured factor.
-
getOperandExpression
public Expression getOperandExpression()
Description copied from class:UnaryOperatorExpression
Gets the operand expression for this unary operator- Overrides:
getOperandExpression
in classUnaryOperatorExpression
- Returns:
- Returns the operandExpression.
-
-