STAMINA/STORM 0.1
Infinite state-space truncator which generates a probability within a window
PropertyWizard.h
1#ifndef STAMINA_PROPERTY_WIZARD_H
2#define STAMINA_PROPERTY_WIZARD_H
3
4#include "ui/ui_PropertyWizard.h"
5
6#include <QDialog>
7#include <QString>
8#include <cstdint>
9#include <QStandardItemModel>
10#include <QVector>
11#include <QVariant>
12
13namespace stamina {
14 namespace gui {
15 enum OPERAND_TYPE {
16 BINARY_OPERAND
17 , UNARY_OPERAND
18 , VARIABLE
19 , VALUE
20 , EMPTY
21 };
22 typedef uint8_t operandType_t;
24 QString operand;
25 QString description;
26 OperandAndDescription(QString operand, QString description)
27 : operand(operand), description(description) { /* Intentionally left empty */ }
28 };
30 inline const static OperandAndDescription binaryOperands[] = {
31 // Logic operands
32 OperandAndDescription("&", "AND Operand") // AND Operand
33 , OperandAndDescription("|", "OR Operand") // OR Operand
34 // Path-formula Operands
35 , OperandAndDescription("U", "Until Operand") // Until operand
36// , OperandAndDescription("U <=", "Bounded Until Operand") // TODO: Until operand
37 // Math Operands
38 , OperandAndDescription("+", "Addition Operand") // Add
39 , OperandAndDescription("-", "Subtraction Operand") // Subtract
40 , OperandAndDescription("*", "Multiply Operand") // Multiply
41 , OperandAndDescription("/", "Division Operand") // divide
42 };
43 inline const static OperandAndDescription unaryOperands[] = {
44 // Logic operands
45 OperandAndDescription("!", "NOT Operand") // NOT Operand
46 // Path-formula Operands
47 , OperandAndDescription("F", "Eventually Operand") // Eventually Operand
48 , OperandAndDescription("G", "Always (globally) Operand") // Always Operand
49 , OperandAndDescription("X", "Next Operand") // Next Operand
50 // Math Operands
51 , OperandAndDescription("-", "Numeric Negation Operand") // Subtract
52 };
53 };
54 class PropertyWizard : public QDialog {
55 Q_OBJECT
56 public:
57 PropertyWizard(QWidget * parent = nullptr);
58 protected:
59 void setupActions();
68 void insertOperand(QString opString, operandType_t opType);
69 std::vector<QString> variables;
70 private slots:
74 void getInfoAndInsertOperand();
78 void deleteSelectedOperand();
82 void updateValuesInExpressionOptions(int oldIndex);
83 };
84
85 /* An operand item stored in the PropertyTree */
86 class OperandItem : QStandardItem {
87 Q_OBJECT
88 public:
89 // TODO: https://doc.qt.io/qt-5/qtwidgets-itemviews-simpletreemodel-example.html
90 explicit OperandItem(
91 int rows
92 , int columns = 1
93 , operandType_t opType = OPERAND_TYPE::EMPTY
94 );
95
96 QString createExpressionFromThisAndChildren();
97 operandType_t opType;
98 private:
99 };
100
101 class PropertyTreeModel : public QStandardItemModel {
102 Q_OBJECT
103 public:
104 PropertyTreeModel(const QString &data, QObject *parent = nullptr);
105
106 QString toPropertyString();
107 };
108 }
109}
110#endif // STAMINA_PROPERTY_WIZARD_H
Definition: ui_PropertyWizard.h:180
Definition: PropertyWizard.h:86
Definition: PropertyWizard.h:101
Definition: PropertyWizard.h:54
void insertOperand(QString opString, operandType_t opType)
Definition: PropertyWizard.cpp:38
Definition: ExplicitTruncatedModelBuilder.cpp:40
Definition: PropertyWizard.h:23
Definition: PropertyWizard.h:29