|
@ -8,17 +8,24 @@ |
|
|
#ifndef STORM_FORMULA_OR_H_ |
|
|
#ifndef STORM_FORMULA_OR_H_ |
|
|
#define STORM_FORMULA_OR_H_ |
|
|
#define STORM_FORMULA_OR_H_ |
|
|
|
|
|
|
|
|
#include "PctlStateFormula.h" |
|
|
#include "AbstractStateFormula.h" |
|
|
|
|
|
|
|
|
namespace storm { |
|
|
namespace storm { |
|
|
|
|
|
|
|
|
namespace formula { |
|
|
namespace formula { |
|
|
|
|
|
|
|
|
|
|
|
template <class T> class Or; |
|
|
|
|
|
|
|
|
|
|
|
template <class T> |
|
|
|
|
|
class IOrModelChecker { |
|
|
|
|
|
public: |
|
|
|
|
|
virtual storm::storage::BitVector* checkOr(const Or<T>& obj) const = 0; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
/*! |
|
|
/*! |
|
|
* @brief |
|
|
* @brief |
|
|
* Class for a PCTL formula tree with OR node as root. |
|
|
* Class for a Abstract formula tree with OR node as root. |
|
|
* |
|
|
* |
|
|
* Has two PCTL state formulas as sub formulas/trees. |
|
|
* Has two Abstract state formulas as sub formulas/trees. |
|
|
* |
|
|
* |
|
|
* As OR is commutative, the order is \e theoretically not important, but will influence the order in which |
|
|
* As OR is commutative, the order is \e theoretically not important, but will influence the order in which |
|
|
* the model checker works. |
|
|
* the model checker works. |
|
@ -26,11 +33,11 @@ namespace formula { |
|
|
* The subtrees are seen as part of the object and deleted with the object |
|
|
* The subtrees are seen as part of the object and deleted with the object |
|
|
* (this behavior can be prevented by setting them to NULL before deletion) |
|
|
* (this behavior can be prevented by setting them to NULL before deletion) |
|
|
* |
|
|
* |
|
|
* @see PctlStateFormula |
|
|
* @see AbstractStateFormula |
|
|
* @see PctlFormula |
|
|
* @see AbstractFormula |
|
|
*/ |
|
|
*/ |
|
|
template <class T> |
|
|
template <class T> |
|
|
class Or : public PctlStateFormula<T> { |
|
|
class Or : public AbstractStateFormula<T> { |
|
|
|
|
|
|
|
|
public: |
|
|
public: |
|
|
/*! |
|
|
/*! |
|
@ -49,7 +56,7 @@ public: |
|
|
* @param left The left sub formula |
|
|
* @param left The left sub formula |
|
|
* @param right The right sub formula |
|
|
* @param right The right sub formula |
|
|
*/ |
|
|
*/ |
|
|
Or(PctlStateFormula<T>* left, PctlStateFormula<T>* right) { |
|
|
Or(AbstractStateFormula<T>* left, AbstractStateFormula<T>* right) { |
|
|
this->left = left; |
|
|
this->left = left; |
|
|
this->right = right; |
|
|
this->right = right; |
|
|
} |
|
|
} |
|
@ -74,7 +81,7 @@ public: |
|
|
* |
|
|
* |
|
|
* @param newLeft the new left child. |
|
|
* @param newLeft the new left child. |
|
|
*/ |
|
|
*/ |
|
|
void setLeft(PctlStateFormula<T>* newLeft) { |
|
|
void setLeft(AbstractStateFormula<T>* newLeft) { |
|
|
left = newLeft; |
|
|
left = newLeft; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -83,21 +90,21 @@ public: |
|
|
* |
|
|
* |
|
|
* @param newRight the new right child. |
|
|
* @param newRight the new right child. |
|
|
*/ |
|
|
*/ |
|
|
void setRight(PctlStateFormula<T>* newRight) { |
|
|
void setRight(AbstractStateFormula<T>* newRight) { |
|
|
right = newRight; |
|
|
right = newRight; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*! |
|
|
/*! |
|
|
* @returns a pointer to the left child node |
|
|
* @returns a pointer to the left child node |
|
|
*/ |
|
|
*/ |
|
|
const PctlStateFormula<T>& getLeft() const { |
|
|
const AbstractStateFormula<T>& getLeft() const { |
|
|
return *left; |
|
|
return *left; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*! |
|
|
/*! |
|
|
* @returns a pointer to the right child node |
|
|
* @returns a pointer to the right child node |
|
|
*/ |
|
|
*/ |
|
|
const PctlStateFormula<T>& getRight() const { |
|
|
const AbstractStateFormula<T>& getRight() const { |
|
|
return *right; |
|
|
return *right; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -120,7 +127,7 @@ public: |
|
|
* |
|
|
* |
|
|
* @returns a new AND-object that is identical the called object. |
|
|
* @returns a new AND-object that is identical the called object. |
|
|
*/ |
|
|
*/ |
|
|
virtual PctlStateFormula<T>* clone() const { |
|
|
virtual AbstractStateFormula<T>* clone() const { |
|
|
Or<T>* result = new Or(); |
|
|
Or<T>* result = new Or(); |
|
|
if (this->left != NULL) { |
|
|
if (this->left != NULL) { |
|
|
result->setLeft(left->clone()); |
|
|
result->setLeft(left->clone()); |
|
@ -130,7 +137,7 @@ public: |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*! |
|
|
/*! |
|
|
* Calls the model checker to check this formula. |
|
|
* Calls the model checker to check this formula. |
|
|
* Needed to infer the correct type of formula class. |
|
|
* Needed to infer the correct type of formula class. |
|
@ -140,13 +147,13 @@ public: |
|
|
* |
|
|
* |
|
|
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|
|
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|
|
*/ |
|
|
*/ |
|
|
virtual storm::storage::BitVector *check(const storm::modelChecker::DtmcPrctlModelChecker<T>& modelChecker) const { |
|
|
virtual storm::storage::BitVector *check(const IOrModelChecker<T>& modelChecker) const { |
|
|
return modelChecker.checkOr(*this); |
|
|
return modelChecker.checkOr(*this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private: |
|
|
private: |
|
|
PctlStateFormula<T>* left; |
|
|
AbstractStateFormula<T>* left; |
|
|
PctlStateFormula<T>* right; |
|
|
AbstractStateFormula<T>* right; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
} //namespace formula |
|
|
} //namespace formula |
|
|
xxxxxxxxxx