Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::expressions::BinaryNumericalFunctionExpression Class Reference

#include <BinaryNumericalFunctionExpression.h>

Inheritance diagram for storm::expressions::BinaryNumericalFunctionExpression:
Collaboration diagram for storm::expressions::BinaryNumericalFunctionExpression:

Public Types

enum class  OperatorType {
  Plus , Minus , Times , Divide ,
  Min , Max , Power , Modulo ,
  Logarithm
}
 An enum type specifying the different operators applicable. More...
 

Public Member Functions

 BinaryNumericalFunctionExpression (ExpressionManager const &manager, Type const &type, std::shared_ptr< BaseExpression const > const &firstOperand, std::shared_ptr< BaseExpression const > const &secondOperand, OperatorType operatorType)
 Constructs a binary numerical function expression with the given return type, operands and operator.
 
 BinaryNumericalFunctionExpression (BinaryNumericalFunctionExpression const &other)=default
 
BinaryNumericalFunctionExpressionoperator= (BinaryNumericalFunctionExpression const &other)=delete
 
 BinaryNumericalFunctionExpression (BinaryNumericalFunctionExpression &&)=default
 
BinaryNumericalFunctionExpressionoperator= (BinaryNumericalFunctionExpression &&)=delete
 
virtual ~BinaryNumericalFunctionExpression ()=default
 
virtual storm::expressions::OperatorType getOperator () const override
 Retrieves the operator of a function application.
 
virtual int_fast64_t evaluateAsInt (Valuation const *valuation=nullptr) const override
 Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting integer value.
 
virtual double evaluateAsDouble (Valuation const *valuation=nullptr) const override
 Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting double value.
 
virtual std::shared_ptr< BaseExpression const > simplify () const override
 Simplifies the expression according to some simple rules.
 
virtual boost::any accept (ExpressionVisitor &visitor, boost::any const &data) const override
 Accepts the given visitor by calling its visit method.
 
virtual bool isBinaryNumericalFunctionExpression () const override
 
OperatorType getOperatorType () const
 Retrieves the operator associated with the expression.
 
- Public Member Functions inherited from storm::expressions::BinaryExpression
 BinaryExpression (ExpressionManager const &manager, Type const &type, std::shared_ptr< BaseExpression const > const &firstOperand, std::shared_ptr< BaseExpression const > const &secondOperand)
 Constructs a binary expression with the given return type and operands.
 
 BinaryExpression (BinaryExpression const &other)=default
 
BinaryExpressionoperator= (BinaryExpression const &other)=delete
 
 BinaryExpression (BinaryExpression &&)=default
 
BinaryExpressionoperator= (BinaryExpression &&)=delete
 
virtual ~BinaryExpression ()=default
 
virtual bool isFunctionApplication () const override
 Checks if the expression is a function application (of any sort).
 
virtual bool containsVariables () const override
 Retrieves whether the expression contains a variable.
 
virtual uint_fast64_t getArity () const override
 Returns the arity of the expression.
 
virtual std::shared_ptr< BaseExpression const > getOperand (uint_fast64_t operandIndex) const override
 Retrieves the given operand from the expression.
 
virtual void gatherVariables (std::set< storm::expressions::Variable > &variables) const override
 Retrieves the set of all variables that appear in the expression.
 
std::shared_ptr< BaseExpression const > const & getFirstOperand () const
 Retrieves the first operand of the expression.
 
std::shared_ptr< BaseExpression const > const & getSecondOperand () const
 Retrieves the second operand of the expression.
 
- Public Member Functions inherited from storm::expressions::BaseExpression
 BaseExpression (ExpressionManager const &manager, Type const &type)
 Constructs a base expression with the given return type.
 
 BaseExpression (BaseExpression const &)=default
 
BaseExpressionoperator= (BaseExpression const &)=delete
 
 BaseExpression (BaseExpression &&)=default
 
BaseExpressionoperator= (BaseExpression &&)=delete
 
virtual ~BaseExpression ()=default
 
Expression toExpression () const
 Converts the base expression to a proper expression.
 
virtual bool evaluateAsBool (Valuation const *valuation=nullptr) const
 Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting boolean value.
 
virtual storm::RationalNumber evaluateAsRational () const
 Evaluates the expression and returns the resulting rational number.
 
virtual std::string const & getIdentifier () const
 Retrieves the identifier associated with this expression.
 
virtual bool isLiteral () const
 Retrieves whether the expression is a literal.
 
virtual bool isVariable () const
 Retrieves whether the expression is a variable.
 
virtual bool isTrue () const
 Checks if the expression is equal to the boolean literal true.
 
virtual bool isFalse () const
 Checks if the expression is equal to the boolean literal false.
 
std::shared_ptr< BaseExpression const > reduceNesting () const
 Tries to flatten the syntax tree of the expression, e.g., 1 + (2 + (3 + 4)) becomes (1 + 2) + (3 + 4)
 
bool hasNumericalType () const
 Retrieves whether the expression has a numerical type, i.e., integer or double.
 
bool hasIntegerType () const
 Retrieves whether the expression has an integer type.
 
bool hasBitVectorType () const
 Retrieves whether the expression has a bitvector type.
 
bool hasBooleanType () const
 Retrieves whether the expression has a boolean type.
 
bool hasRationalType () const
 Retrieves whether the expression has a rational return type.
 
std::shared_ptr< BaseExpression const > getSharedPointer () const
 Retrieves a shared pointer to this expression.
 
ExpressionManager const & getManager () const
 Retrieves the manager responsible for this expression.
 
Type const & getType () const
 Retrieves the type of the expression.
 
virtual bool isIfThenElseExpression () const
 
IfThenElseExpression const & asIfThenElseExpression () const
 
virtual bool isBinaryBooleanFunctionExpression () const
 
BinaryBooleanFunctionExpression const & asBinaryBooleanFunctionExpression () const
 
BinaryNumericalFunctionExpression const & asBinaryNumericalFunctionExpression () const
 
virtual bool isBinaryRelationExpression () const
 
BinaryRelationExpression const & asBinaryRelationExpression () const
 
virtual bool isBooleanLiteralExpression () const
 
BooleanLiteralExpression const & asBooleanLiteralExpression () const
 
virtual bool isIntegerLiteralExpression () const
 
IntegerLiteralExpression const & asIntegerLiteralExpression () const
 
virtual bool isRationalLiteralExpression () const
 
RationalLiteralExpression const & asRationalLiteralExpression () const
 
virtual bool isUnaryBooleanFunctionExpression () const
 
UnaryBooleanFunctionExpression const & asUnaryBooleanFunctionExpression () const
 
virtual bool isUnaryNumericalFunctionExpression () const
 
UnaryNumericalFunctionExpression const & asUnaryNumericalFunctionExpression () const
 
virtual bool isVariableExpression () const
 
VariableExpression const & asVariableExpression () const
 
virtual bool isPredicateExpression () const
 
PredicateExpression const & asPredicateExpression () const
 

Protected Member Functions

virtual void printToStream (std::ostream &stream) const override
 Prints the expression to the given stream.
 

Detailed Description

Definition at line 9 of file BinaryNumericalFunctionExpression.h.

Member Enumeration Documentation

◆ OperatorType

An enum type specifying the different operators applicable.

Enumerator
Plus 
Minus 
Times 
Divide 
Min 
Max 
Power 
Modulo 
Logarithm 

Definition at line 14 of file BinaryNumericalFunctionExpression.h.

Constructor & Destructor Documentation

◆ BinaryNumericalFunctionExpression() [1/3]

storm::expressions::BinaryNumericalFunctionExpression::BinaryNumericalFunctionExpression ( ExpressionManager const &  manager,
Type const &  type,
std::shared_ptr< BaseExpression const > const &  firstOperand,
std::shared_ptr< BaseExpression const > const &  secondOperand,
OperatorType  operatorType 
)

Constructs a binary numerical function expression with the given return type, operands and operator.

Parameters
managerThe manager responsible for this expression.
typeThe return type of the expression.
firstOperandThe first operand of the expression.
secondOperandThe second operand of the expression.
functionTypeThe operator of the expression.

Definition at line 20 of file BinaryNumericalFunctionExpression.cpp.

◆ BinaryNumericalFunctionExpression() [2/3]

storm::expressions::BinaryNumericalFunctionExpression::BinaryNumericalFunctionExpression ( BinaryNumericalFunctionExpression const &  other)
default

◆ BinaryNumericalFunctionExpression() [3/3]

storm::expressions::BinaryNumericalFunctionExpression::BinaryNumericalFunctionExpression ( BinaryNumericalFunctionExpression &&  )
default

◆ ~BinaryNumericalFunctionExpression()

virtual storm::expressions::BinaryNumericalFunctionExpression::~BinaryNumericalFunctionExpression ( )
virtualdefault

Member Function Documentation

◆ accept()

boost::any storm::expressions::BinaryNumericalFunctionExpression::accept ( ExpressionVisitor visitor,
boost::any const &  data 
) const
overridevirtual

Accepts the given visitor by calling its visit method.

Parameters
visitorThe visitor that is to be accepted.

Implements storm::expressions::BaseExpression.

Definition at line 263 of file BinaryNumericalFunctionExpression.cpp.

◆ evaluateAsDouble()

double storm::expressions::BinaryNumericalFunctionExpression::evaluateAsDouble ( Valuation const *  valuation = nullptr) const
overridevirtual

Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting double value.

If the return type of the expression is not a double an exception is thrown.

Parameters
valuationThe valuation of unknowns under which to evaluate the expression.
Returns
The double value of the expression under the given valuation.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 116 of file BinaryNumericalFunctionExpression.cpp.

◆ evaluateAsInt()

int_fast64_t storm::expressions::BinaryNumericalFunctionExpression::evaluateAsInt ( Valuation const *  valuation = nullptr) const
overridevirtual

Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting integer value.

If the return type of the expression is not an integer an exception is thrown.

Parameters
valuationThe valuation of unknowns under which to evaluate the expression.
Returns
The integer value of the expression under the given valuation.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 78 of file BinaryNumericalFunctionExpression.cpp.

◆ getOperator()

storm::expressions::OperatorType storm::expressions::BinaryNumericalFunctionExpression::getOperator ( ) const
overridevirtual

Retrieves the operator of a function application.

This is only legal to call if the expression is function application.

Returns
The operator associated with the function application.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 31 of file BinaryNumericalFunctionExpression.cpp.

◆ getOperatorType()

BinaryNumericalFunctionExpression::OperatorType storm::expressions::BinaryNumericalFunctionExpression::getOperatorType ( ) const

Retrieves the operator associated with the expression.

Returns
The operator associated with the expression.

Definition at line 27 of file BinaryNumericalFunctionExpression.cpp.

◆ isBinaryNumericalFunctionExpression()

bool storm::expressions::BinaryNumericalFunctionExpression::isBinaryNumericalFunctionExpression ( ) const
overridevirtual

Reimplemented from storm::expressions::BaseExpression.

Definition at line 267 of file BinaryNumericalFunctionExpression.cpp.

◆ operator=() [1/2]

BinaryNumericalFunctionExpression & storm::expressions::BinaryNumericalFunctionExpression::operator= ( BinaryNumericalFunctionExpression &&  )
delete

◆ operator=() [2/2]

BinaryNumericalFunctionExpression & storm::expressions::BinaryNumericalFunctionExpression::operator= ( BinaryNumericalFunctionExpression const &  other)
delete

◆ printToStream()

void storm::expressions::BinaryNumericalFunctionExpression::printToStream ( std::ostream &  stream) const
overrideprotectedvirtual

Prints the expression to the given stream.

Parameters
streamThe stream to which to write the expression.

Implements storm::expressions::BaseExpression.

Definition at line 271 of file BinaryNumericalFunctionExpression.cpp.

◆ simplify()

std::shared_ptr< BaseExpression const > storm::expressions::BinaryNumericalFunctionExpression::simplify ( ) const
overridevirtual

Simplifies the expression according to some simple rules.

Returns
A pointer to the simplified expression.

Implements storm::expressions::BaseExpression.

Definition at line 154 of file BinaryNumericalFunctionExpression.cpp.


The documentation for this class was generated from the following files: