Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
RationalLiteralExpression.cpp
Go to the documentation of this file.
4
6
7namespace storm {
8namespace expressions {
10 : BaseExpression(manager, manager.getRationalType()), value(storm::utility::convertNumber<storm::RationalNumber>(value)) {
11 // Intentionally left empty.
12}
13
14RationalLiteralExpression::RationalLiteralExpression(ExpressionManager const& manager, std::string const& valueAsString)
15 : BaseExpression(manager, manager.getRationalType()), value(storm::utility::convertNumber<storm::RationalNumber>(valueAsString)) {
16 // Intentionally left empty.
17}
18
19RationalLiteralExpression::RationalLiteralExpression(ExpressionManager const& manager, storm::RationalNumber const& value)
20 : BaseExpression(manager, manager.getRationalType()), value(value) {
21 // Intentionally left empty.
22}
23
25 return this->getValueAsDouble();
26}
27
29 return true;
30}
31
32void RationalLiteralExpression::gatherVariables(std::set<storm::expressions::Variable>&) const {
33 return;
34}
35
36std::shared_ptr<BaseExpression const> RationalLiteralExpression::simplify() const {
37 return this->shared_from_this();
38}
39
40boost::any RationalLiteralExpression::accept(ExpressionVisitor& visitor, boost::any const& data) const {
41 return visitor.visit(*this, data);
42}
43
47
49 return storm::utility::convertNumber<double>(this->value);
50}
51
52storm::RationalNumber RationalLiteralExpression::getValue() const {
53 return this->value;
54}
55
56void RationalLiteralExpression::printToStream(std::ostream& stream) const {
57 stream << this->getValue();
58}
59} // namespace expressions
60} // namespace storm
The base class of all expression classes.
This class is responsible for managing a set of typed variables and all expressions using these varia...
virtual boost::any visit(IfThenElseExpression const &expression, boost::any const &data)=0
double getValueAsDouble() const
Retrieves the value of the double literal.
storm::RationalNumber getValue() const
Retrieves the value of the double literal.
virtual double evaluateAsDouble(Valuation const *valuation=nullptr) const override
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valua...
virtual void printToStream(std::ostream &stream) const override
Prints the expression to the given stream.
virtual void gatherVariables(std::set< storm::expressions::Variable > &variables) const override
Retrieves the set of all variables that appear in the expression.
RationalLiteralExpression(ExpressionManager const &manager, double value)
Creates an double literal expression with the given value.
virtual boost::any accept(ExpressionVisitor &visitor, boost::any const &data) const override
Accepts the given visitor by calling its visit method.
virtual bool isLiteral() const override
Retrieves whether the expression is a literal.
virtual std::shared_ptr< BaseExpression const > simplify() const override
Simplifies the expression according to some simple rules.
The base class of all valuations of variables.
Definition Valuation.h:16
LabParser.cpp.
Definition cli.cpp:18