Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BinaryBooleanStateFormula.cpp
Go to the documentation of this file.
2#include <boost/any.hpp>
3#include <ostream>
4
6
9
10namespace storm {
11namespace logic {
12BinaryBooleanStateFormula::BinaryBooleanStateFormula(OperatorType operatorType, std::shared_ptr<Formula const> const& leftSubformula,
13 std::shared_ptr<Formula const> const& rightSubformula)
14 : BinaryStateFormula(leftSubformula, rightSubformula), operatorType(operatorType) {
16 storm::exceptions::InvalidPropertyException, "Boolean formula must have subformulas with qualitative result.");
17}
18
22
23boost::any BinaryBooleanStateFormula::accept(FormulaVisitor const& visitor, boost::any const& data) const {
24 return visitor.visit(*this, data);
25}
26
30
32 return this->getOperator() == OperatorType::And;
33}
34
36 return this->getOperator() == OperatorType::Or;
37}
38
39std::ostream& BinaryBooleanStateFormula::writeToStream(std::ostream& out, bool allowParentheses) const {
40 if (allowParentheses) {
41 out << "(";
42 }
43 this->getLeftSubformula().writeToStream(out, true);
44 switch (operatorType) {
45 case OperatorType::And:
46 out << " & ";
47 break;
48 case OperatorType::Or:
49 out << " | ";
50 break;
51 }
52 this->getRightSubformula().writeToStream(out, true);
53 if (allowParentheses) {
54 out << ")";
55 }
56 return out;
57}
58} // namespace logic
59} // namespace storm
BinaryBooleanStateFormula(OperatorType operatorType, std::shared_ptr< Formula const > const &leftSubformula, std::shared_ptr< Formula const > const &rightSubformula)
virtual boost::any accept(FormulaVisitor const &visitor, boost::any const &data) const override
virtual bool isBinaryBooleanStateFormula() const override
virtual std::ostream & writeToStream(std::ostream &out, bool allowParentheses=false) const override
Writes the forumla to the given output stream.
Formula const & getRightSubformula() const
Formula const & getLeftSubformula() const
virtual std::ostream & writeToStream(std::ostream &out, bool allowParentheses=false) const =0
Writes the forumla to the given output stream.
virtual bool hasQualitativeResult() const
Definition Formula.cpp:188
virtual boost::any visit(AtomicExpressionFormula const &f, boost::any const &data) const =0
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
LabParser.cpp.
Definition cli.cpp:18