-
Notifications
You must be signed in to change notification settings - Fork 0
/
formulas.hpp
74 lines (68 loc) · 1.68 KB
/
formulas.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#include<vector>
#include<tuple>
#include"tarsky.hpp"
//should modify negative modifier
//should become virtual
namespace Kirill
{
class Predicate
{
private:
Polynom _polynom;
bool _value{0};
bool _negative;
public:
Predicate(Polynom polynom,bool negative);
Predicate();
Polynom get_polynom();
virtual bool calculate(std::vector<int> &column, std::vector<Polynom> &DNF_polynoms)=0;
double polynom_in_point();
bool get_value();
void set_value(bool);
bool get_negative();
virtual ~Predicate()=0;
};
class Equality_predicate : public Predicate
{
public:
Equality_predicate();
Equality_predicate(Polynom polynom,bool negative);
bool calculate(std::vector<int> &column, std::vector<Polynom> &DNF_polynoms) override;
~Equality_predicate();
};
class Greater_predicate : public Predicate
{
public:
Greater_predicate();
Greater_predicate(Polynom polynom, bool negative);
bool calculate(std::vector<int> &column, std::vector<Polynom> &DNF_polynoms) override;
~Greater_predicate();
};
class Conjunct
{
private:
std::vector<Predicate*> _predicats;
public:
Conjunct(std::vector<Predicate*> predicats);
Conjunct();
void clear();
bool calculate(std::vector<int> &column, std::vector<Polynom> &DNF_polynoms);
void add_predicate(Predicate *);
std::vector<Predicate*> getPredicates(); //для Димасика
~Conjunct();
};
class DNF
{
private:
std::vector<Conjunct> _conjuncts;
public:
DNF(std::vector<Conjunct> conjuncts);
DNF();
bool calculate(std::vector<int> &column, std::vector<Polynom> &DNF_polynoms);
bool decide();
void add_conjunct(Conjunct);
void printPolynoms(); //для Димасика
~DNF();
};
}