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,1is 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 ExpressiongetOperandExpression()Gets the operand expression for this unary operatorTypegetReturnType()Gets the return type of the expression.ValueObjectgetValue()Evaluates the expression, that is, the corresponding fold operation is executed.voidinitialize(ExpressionContext expressionContext, Object parameters, boolean validate)Initializes the operand expression.protected voidvalidate(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:ExpressionGets the return type of the expression.- Specified by:
getReturnTypein interfaceExpression- Overrides:
getReturnTypein 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
ValueObjectofType.DOUBLEthat 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:UnaryOperatorExpressionInitializes the operand expression.- Specified by:
initializein interfaceExpression- Overrides:
initializein 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 aCustomExpressionContextinstance.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:UnaryOperatorExpressionValidates the expression.- Overrides:
validatein classUnaryOperatorExpression- Throws:
AssertionError- In case the given expression context is not aCustomExpressionContextinstance.ExpressionEngineException- In case the operand does not contain any measured factor.
-
getOperandExpression
public Expression getOperandExpression()
Description copied from class:UnaryOperatorExpressionGets the operand expression for this unary operator- Overrides:
getOperandExpressionin classUnaryOperatorExpression- Returns:
- Returns the operandExpression.
-
-