Class ExpressionSolveVisitor


  • public class ExpressionSolveVisitor
    extends StoexSwitch<Object>
    A visitor for stochastic expressions, which evaluates the operations within a expression and returns the resulting expression, which does not contain any operation any more. For example, when a stochastic expression contains a division operation between a INT_PMF and a constant it returns an INT_PMF divided by the constant. The visitor is invoked as usual via the doSwitch(Expression toSolve) command. It returns the solved expression. This class uses the operations in de.uka.ipd.sdq.stoex.analyser.operations as an interface to the probability function package.
    • Constructor Detail

      • ExpressionSolveVisitor

        public ExpressionSolveVisitor​(HashMap<Expression,​TypeEnum> typeAnn,
                                      StoexSerialiser stoexSerialiser)
        Constructor storing the evaluated type annotations.
        Parameters:
        typeAnn -
    • Method Detail

      • caseIfElseExpression

        public Object caseIfElseExpression​(IfElseExpression expr)
        Description copied from class: StoexSwitch
        Returns the result of interpreting the object as an instance of 'If Else Expression'. This implementation returns null; returning a non-null result will terminate the switch.
        Overrides:
        caseIfElseExpression in class StoexSwitch<Object>
        Parameters:
        expr - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'If Else Expression'.
        See Also:
        doSwitch(EObject)
      • caseParenthesis

        public Object caseParenthesis​(Parenthesis parenthesis)
        Forwards the visitor to the inner expression within the parenthesis.
        Overrides:
        caseParenthesis in class StoexSwitch<Object>
        Parameters:
        parenthesis - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'Parenthesis'.
        See Also:
        doSwitch(EObject)
      • caseVariable

        public Object caseVariable​(Variable var)
        Skips variables. This visitor cannot handle variables. Use the PCM Solver to handle variables in stochastic expressions.
        Overrides:
        caseVariable in class StoexSwitch<Object>
        Parameters:
        var - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'Variable'.
        See Also:
        doSwitch(EObject)
      • caseStringLiteral

        public Object caseStringLiteral​(StringLiteral object)
        Description copied from class: StoexSwitch
        Returns the result of interpreting the object as an instance of 'String Literal'. This implementation returns null; returning a non-null result will terminate the switch.
        Overrides:
        caseStringLiteral in class StoexSwitch<Object>
        Parameters:
        object - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'String Literal'.
        See Also:
        doSwitch(EObject)
      • caseFunctionLiteral

        public Atom caseFunctionLiteral​(FunctionLiteral object)
        Description copied from class: StoexSwitch
        Returns the result of interpreting the object as an instance of 'Function Literal'. This implementation returns null; returning a non-null result will terminate the switch.
        Overrides:
        caseFunctionLiteral in class StoexSwitch<Object>
        Parameters:
        object - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'Function Literal'.
        See Also:
        doSwitch(EObject)
      • caseNotExpression

        public Object caseNotExpression​(NotExpression notExpression)
        Returns the result of interpreting the object as an instance of 'Not Expression'. This implementation casts the result of its inner expression to boolean and returns the resulting values. If it cannot be cast to Boolean or BoolPMF, an exception is thrown.
        Overrides:
        caseNotExpression in class StoexSwitch<Object>
        Parameters:
        notExpression - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'Not Expression'.
        See Also:
        doSwitch(EObject)
        Generated class or method.