You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

125 lines
2.8 KiB

/*
* Ap.h
*
* Created on: 19.10.2012
* Author: Thomas Heinemann
*/
#ifndef STORM_FORMULA_AP_H_
#define STORM_FORMULA_AP_H_
#include "src/formula/AbstractStateFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {
namespace formula {
template <class T> class Ap;
/*!
* @brief Interface class for model checkers that support Ap.
*
* All model checkers that support the formula class Ap must inherit
* this pure virtual class.
*/
template <class T>
class IApModelChecker {
public:
/*!
* @brief Evaluates Ap formula within a model checker.
*
* @param obj Formula object with subformulas.
* @return Result of the formula for every node.
*/
virtual storm::storage::BitVector* checkAp(const Ap<T>& obj) const = 0;
};
/*!
* @brief
* Class for a Abstract formula tree with atomic proposition as root.
*
* This class represents the leaves in the formula tree.
*
* @see AbstractStateFormula
* @see AbstractFormula
*/
template <class T>
class Ap : public AbstractStateFormula<T> {
public:
/*!
* Constructor
*
* Creates a new atomic proposition leaf, with the label Ap
*
* @param ap The string representing the atomic proposition
*/
Ap(std::string ap) {
this->ap = ap;
}
/*!
* Destructor.
* At this time, empty...
*/
virtual ~Ap() { }
/*!
* @returns the name of the atomic proposition
*/
const std::string& getAp() const {
return ap;
}
/*!
* @returns a string representation of the leaf.
*
*/
virtual std::string toString() const {
return getAp();
}
/*!
* Clones the called object.
*
* @returns a new Ap-object that is identical the called object.
*/
virtual AbstractStateFormula<T>* clone() const {
return new Ap(ap);
}
/*!
* Calls the model checker to check this formula.
* Needed to infer the correct type of formula class.
*
* @note This function should only be called in a generic check function of a model checker class. For other uses,
* the methods of the model checker should be used.
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector *check(const storm::modelChecker::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IApModelChecker>()->checkAp(*this);
}
/*!
* @brief Checks if all subtrees conform to some logic.
*
* As atomic propositions have no subformulas, we return true here.
*
* @param checker Formula checker object.
* @return true
*/
virtual bool conforms(const AbstractFormulaChecker<T>& checker) const {
return true;
}
private:
std::string ap;
};
} //namespace formula
} //namespace storm
#endif /* STORM_FORMULA_AP_H_ */