2
// Created by niels on 3/20/19.
5
#ifndef VERIFYPN_TIMEINVARIANT_H
6
#define VERIFYPN_TIMEINVARIANT_H
16
namespace PetriEngine {
21
TimeInvariant(Colored::Color color) : strictComparison(true), bound(std::numeric_limits<int>::max()), color(color) {};
22
TimeInvariant(bool strictComparison, int bound, PetriEngine::Colored::Color color) : strictComparison(strictComparison), bound(bound), color(color) { };
23
TimeInvariant(const TimeInvariant& ti) : strictComparison(ti.strictComparison), bound(ti.bound), color(ti.color) { };
24
TimeInvariant& operator=(const TimeInvariant& ti)
26
strictComparison = ti.strictComparison;
31
virtual ~TimeInvariant(){ /*Left empty*/ };
34
void print(std::ostream& out) const;
35
inline const int getBound() const { return bound; }
36
inline const bool isBoundStrict() const { return strictComparison; }
39
static TimeInvariant createFor(const std::string& invariant, std::vector<const Colored::Color*> colors);
40
static Colored::Color createColor(std::vector<const Colored::Color*> colors);
43
bool strictComparison;
48
inline bool operator==(const TimeInvariant& a, const TimeInvariant& b)
50
return a.getBound() == b.getBound() && a.isBoundStrict() == b.isBoundStrict();
53
inline bool operator!=(const TimeInvariant& a, const TimeInvariant& b)
58
inline std::ostream& operator<<(std::ostream& out, const TimeInvariant& invariant)
64
* Singleton pattern from:
65
* https://stackoverflow.com/questions/1008019/c-singleton-design-pattern
67
class TimeInvariantConstant : public TimeInvariant {
69
TimeInvariantConstant();
72
static const TimeInvariant* starColorDotConstant() {
73
static TimeInvariantConstant _instance;
76
TimeInvariantConstant(TimeInvariant const&) = delete;
77
void operator=(TimeInvariant const&) = delete;
78
bool operator==(const TimeInvariant other) {
85
#endif //VERIFYPN_TIMEINVARIANT_H