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

#include <RationalLiteralExpression.h>

Inheritance diagram for storm::expressions::RationalLiteralExpression:
Collaboration diagram for storm::expressions::RationalLiteralExpression:

Public Member Functions

 RationalLiteralExpression (ExpressionManager const &manager, double value)
 Creates an double literal expression with the given value.
 
 RationalLiteralExpression (ExpressionManager const &manager, std::string const &valueAsString)
 Creates an double literal expression with the value given as a string.
 
 RationalLiteralExpression (ExpressionManager const &manager, storm::RationalNumber const &value)
 Creates an double literal expression with the rational value.
 
 RationalLiteralExpression (RationalLiteralExpression const &other)=default
 
RationalLiteralExpressionoperator= (RationalLiteralExpression const &other)=delete
 
 RationalLiteralExpression (RationalLiteralExpression &&)=default
 
RationalLiteralExpressionoperator= (RationalLiteralExpression &&)=delete
 
virtual ~RationalLiteralExpression ()=default
 
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 bool isLiteral () const override
 Retrieves whether the expression is a literal.
 
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 isRationalLiteralExpression () const override
 
double getValueAsDouble () const
 Retrieves the value of the double literal.
 
storm::RationalNumber getValue () const
 Retrieves the value of the double literal.
 
- 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 int_fast64_t evaluateAsInt (Valuation const *valuation=nullptr) const
 Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting integer value.
 
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 std::string const & getIdentifier () const
 Retrieves the identifier associated with this expression.
 
virtual OperatorType getOperator () const
 Retrieves the operator of a function application.
 
virtual bool containsVariables () const
 Retrieves whether the expression contains a variable.
 
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.
 
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
 
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 11 of file RationalLiteralExpression.h.

Constructor & Destructor Documentation

◆ RationalLiteralExpression() [1/5]

storm::expressions::RationalLiteralExpression::RationalLiteralExpression ( ExpressionManager const &  manager,
double  value 
)

Creates an double literal expression with the given value.

Parameters
managerThe manager responsible for this expression.
valueThe value of the double literal.

Definition at line 9 of file RationalLiteralExpression.cpp.

◆ RationalLiteralExpression() [2/5]

storm::expressions::RationalLiteralExpression::RationalLiteralExpression ( ExpressionManager const &  manager,
std::string const &  valueAsString 
)

Creates an double literal expression with the value given as a string.

Parameters
managerThe manager responsible for this expression.
valueThe string representation of the value of the literal.

Definition at line 14 of file RationalLiteralExpression.cpp.

◆ RationalLiteralExpression() [3/5]

storm::expressions::RationalLiteralExpression::RationalLiteralExpression ( ExpressionManager const &  manager,
storm::RationalNumber const &  value 
)

Creates an double literal expression with the rational value.

Parameters
managerThe manager responsible for this expression.
valueThe rational number that is the value of this literal expression.

Definition at line 19 of file RationalLiteralExpression.cpp.

◆ RationalLiteralExpression() [4/5]

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

◆ RationalLiteralExpression() [5/5]

storm::expressions::RationalLiteralExpression::RationalLiteralExpression ( RationalLiteralExpression &&  )
default

◆ ~RationalLiteralExpression()

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

Member Function Documentation

◆ accept()

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

◆ evaluateAsDouble()

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

◆ gatherVariables()

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

◆ getValue()

storm::RationalNumber storm::expressions::RationalLiteralExpression::getValue ( ) const

Retrieves the value of the double literal.

Returns
The value of the double literal.

Definition at line 52 of file RationalLiteralExpression.cpp.

◆ getValueAsDouble()

double storm::expressions::RationalLiteralExpression::getValueAsDouble ( ) const

Retrieves the value of the double literal.

Returns
The value of the double literal.

Definition at line 48 of file RationalLiteralExpression.cpp.

◆ isLiteral()

bool storm::expressions::RationalLiteralExpression::isLiteral ( ) const
overridevirtual

Retrieves whether the expression is a literal.

Returns
True iff the expression is a literal.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 28 of file RationalLiteralExpression.cpp.

◆ isRationalLiteralExpression()

bool storm::expressions::RationalLiteralExpression::isRationalLiteralExpression ( ) const
overridevirtual

Reimplemented from storm::expressions::BaseExpression.

Definition at line 44 of file RationalLiteralExpression.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ printToStream()

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

◆ simplify()

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


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