From 5a2657346be8c313d05687fac0105a579e32f08b Mon Sep 17 00:00:00 2001 From: Stefan Pranger Date: Tue, 16 Feb 2021 17:16:18 +0100 Subject: [PATCH] added shield expression class --- src/storm/logic/ShieldExpression.cpp | 31 +++++++++++++++++++++++++ src/storm/logic/ShieldExpression.h | 34 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 src/storm/logic/ShieldExpression.cpp create mode 100644 src/storm/logic/ShieldExpression.h diff --git a/src/storm/logic/ShieldExpression.cpp b/src/storm/logic/ShieldExpression.cpp new file mode 100644 index 000000000..2959cfd0d --- /dev/null +++ b/src/storm/logic/ShieldExpression.cpp @@ -0,0 +1,31 @@ +#include "storm/logic/ShieldExpression.h" + +namespace storm { + namespace logic { + ShieldExpression::ShieldExpression() {} + + ShieldExpression::ShieldExpression(ShieldingType type, ShieldComparison comparison, double value) : type(type), comparison(comparison), value(value) { + //Intentionally left empty + } + + bool ShieldExpression::isRelative() const { + return comparison == storm::logic::ShieldComparison::Relative; + } + + bool ShieldExpression::isPreSafetyShield() const { + return type == storm::logic::ShieldingType::PreSafety; + } + + bool ShieldExpression::isPostSafetyShield() const { + return type == storm::logic::ShieldingType::PostSafety; + } + + bool ShieldExpression::isOptiomalShield() const { + return type == storm::logic::ShieldingType::Optimal; + } + + double ShieldExpression::getValue() const { + return value; + } + } +} diff --git a/src/storm/logic/ShieldExpression.h b/src/storm/logic/ShieldExpression.h new file mode 100644 index 000000000..9305a2f1f --- /dev/null +++ b/src/storm/logic/ShieldExpression.h @@ -0,0 +1,34 @@ +#pragma once + +#include + +namespace storm { + namespace logic { + + enum class ShieldingType { + PostSafety, + PreSafety, + Optimal + }; + + enum class ShieldComparison { Absolute, Relative }; + + class ShieldExpression { + public: + ShieldExpression(); + ShieldExpression(ShieldingType type, ShieldComparison comparison, double value); + + bool isRelative() const; + bool isPreSafetyShield() const; + bool isPostSafetyShield() const; + bool isOptiomalShield() const; + + double getValue() const; + + private: + ShieldingType type; + ShieldComparison comparison; + double value; + }; + } +}