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

#include <VariableExpression.h>

Inheritance diagram for storm::expressions::VariableExpression:
Collaboration diagram for storm::expressions::VariableExpression:

Public Member Functions

 VariableExpression (Variable const &variable)
 Creates a variable expression with the given return type and variable name.
 
 VariableExpression (VariableExpression const &)=default
 
VariableExpressionoperator= (VariableExpression const &)=delete
 
 VariableExpression (VariableExpression &&)=default
 
VariableExpressionoperator= (VariableExpression &&)=delete
 
virtual ~VariableExpression ()=default
 
virtual bool evaluateAsBool (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 boolean value.
 
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::string const & getIdentifier () const override
 Retrieves the identifier associated with this expression.
 
virtual bool containsVariables () const override
 Retrieves whether the expression contains a variable.
 
virtual bool isVariable () const override
 Retrieves whether the expression is a variable.
 
virtual void gatherVariables (std::set< storm::expressions::Variable > &variables) const override
 Retrieves the set of all variables that appear in the expression.
 
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 isVariableExpression () const override
 
std::string const & getVariableName () const
 Retrieves the name of the variable associated with this expression.
 
Variable const & getVariable () const
 Retrieves the variable associated with this 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 storm::RationalNumber evaluateAsRational () const
 Evaluates the expression and returns the resulting rational number.
 
virtual uint_fast64_t getArity () const
 Returns the arity of the expression.
 
virtual std::shared_ptr< BaseExpression const > getOperand (uint_fast64_t operandIndex) const
 Retrieves the given operand from the expression.
 
virtual OperatorType getOperator () const
 Retrieves the operator of a function application.
 
virtual bool isLiteral () const
 Retrieves whether the expression is a literal.
 
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.
 
virtual bool isFunctionApplication () const
 Checks if the expression is a function application (of any sort).
 
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
 
virtual bool isBinaryNumericalFunctionExpression () 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
 
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 10 of file VariableExpression.h.

Constructor & Destructor Documentation

◆ VariableExpression() [1/3]

storm::expressions::VariableExpression::VariableExpression ( Variable const &  variable)

Creates a variable expression with the given return type and variable name.

Parameters
returnTypeThe return type of the variable expression.
variableNameThe name of the variable associated with this expression.

Definition at line 9 of file VariableExpression.cpp.

◆ VariableExpression() [2/3]

storm::expressions::VariableExpression::VariableExpression ( VariableExpression const &  )
default

◆ VariableExpression() [3/3]

storm::expressions::VariableExpression::VariableExpression ( VariableExpression &&  )
default

◆ ~VariableExpression()

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

Member Function Documentation

◆ accept()

boost::any storm::expressions::VariableExpression::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 66 of file VariableExpression.cpp.

◆ containsVariables()

bool storm::expressions::VariableExpression::containsVariables ( ) const
overridevirtual

Retrieves whether the expression contains a variable.

Returns
True iff the expression contains a variable.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 50 of file VariableExpression.cpp.

◆ evaluateAsBool()

bool storm::expressions::VariableExpression::evaluateAsBool ( 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 boolean value.

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

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

Reimplemented from storm::expressions::BaseExpression.

Definition at line 21 of file VariableExpression.cpp.

◆ evaluateAsDouble()

double storm::expressions::VariableExpression::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 35 of file VariableExpression.cpp.

◆ evaluateAsInt()

int_fast64_t storm::expressions::VariableExpression::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 28 of file VariableExpression.cpp.

◆ gatherVariables()

void storm::expressions::VariableExpression::gatherVariables ( std::set< storm::expressions::Variable > &  variables) const
overridevirtual

Retrieves the set of all variables that appear in the expression.

Parameters
Theset into which all variables in this expresson are inserted.

Implements storm::expressions::BaseExpression.

Definition at line 58 of file VariableExpression.cpp.

◆ getIdentifier()

std::string const & storm::expressions::VariableExpression::getIdentifier ( ) const
overridevirtual

Retrieves the identifier associated with this expression.

This is only legal to call if the expression is a variable.

Returns
The identifier associated with this expression.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 46 of file VariableExpression.cpp.

◆ getVariable()

Variable const & storm::expressions::VariableExpression::getVariable ( ) const

Retrieves the variable associated with this expression.

Returns
The variable associated with this expression.

Definition at line 17 of file VariableExpression.cpp.

◆ getVariableName()

std::string const & storm::expressions::VariableExpression::getVariableName ( ) const

Retrieves the name of the variable associated with this expression.

Returns
The name of the variable.

Definition at line 13 of file VariableExpression.cpp.

◆ isVariable()

bool storm::expressions::VariableExpression::isVariable ( ) const
overridevirtual

Retrieves whether the expression is a variable.

Returns
True iff the expression is a variable.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 54 of file VariableExpression.cpp.

◆ isVariableExpression()

bool storm::expressions::VariableExpression::isVariableExpression ( ) const
overridevirtual

Reimplemented from storm::expressions::BaseExpression.

Definition at line 70 of file VariableExpression.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

VariableExpression & storm::expressions::VariableExpression::operator= ( VariableExpression const &  )
delete

◆ printToStream()

void storm::expressions::VariableExpression::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 74 of file VariableExpression.cpp.

◆ simplify()

std::shared_ptr< BaseExpression const > storm::expressions::VariableExpression::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 62 of file VariableExpression.cpp.


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