Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
UnaryBooleanPathFormula.cpp
Go to the documentation of this file.
2#include <boost/any.hpp>
3#include <ostream>
4
6
9
10namespace storm {
11namespace logic {
12UnaryBooleanPathFormula::UnaryBooleanPathFormula(OperatorType operatorType, std::shared_ptr<Formula const> const& subformula, FormulaContext context)
13 : UnaryPathFormula(subformula), operatorType(operatorType), context(context) {
14 STORM_LOG_THROW(this->getSubformula().isStateFormula() || this->getSubformula().isPathFormula(), storm::exceptions::InvalidPropertyException,
15 "Boolean path formula must have either path or state subformulas");
16 STORM_LOG_THROW(context == FormulaContext::Probability, storm::exceptions::InvalidPropertyException, "Invalid context for formula.");
17}
18
20 return context;
21}
22
24 return true;
25}
26
28 return true;
29}
30
31boost::any UnaryBooleanPathFormula::accept(FormulaVisitor const& visitor, boost::any const& data) const {
32 return visitor.visit(*this, data);
33}
34
38
40 return this->getOperator() == OperatorType::Not;
41}
42
43std::ostream& UnaryBooleanPathFormula::writeToStream(std::ostream& out, bool allowParentheses) const {
44 if (allowParentheses) {
45 out << "(";
46 }
47 switch (operatorType) {
48 case OperatorType::Not:
49 out << "!";
50 break;
51 }
53 if (allowParentheses) {
54 out << ")";
55 }
56 return out;
57}
58} // namespace logic
59} // namespace storm
virtual std::ostream & writeToStream(std::ostream &out, bool allowParentheses=false) const =0
Writes the forumla to the given output stream.
bool isUnaryFormula() const
Definition Formula.cpp:184
virtual bool isStateFormula() const
Definition Formula.cpp:24
virtual boost::any visit(AtomicExpressionFormula const &f, boost::any const &data) const =0
virtual bool isPathFormula() const override
virtual boost::any accept(FormulaVisitor const &visitor, boost::any const &data) const override
virtual std::ostream & writeToStream(std::ostream &out, bool allowParentheses=false) const override
Writes the forumla to the given output stream.
virtual bool isUnaryBooleanPathFormula() const override
virtual bool isProbabilityPathFormula() const override
UnaryBooleanPathFormula(OperatorType operatorType, std::shared_ptr< Formula const > const &subformula, FormulaContext context=FormulaContext::Probability)
Formula const & getSubformula() const
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
LabParser.cpp.
Definition cli.cpp:18