SemOpt  0.2alpha5-SCC
SATFormulae.cpp
Go to the documentation of this file.
1 
9 #include "SATFormulae.h"
10 
15 {
16  this->clauses_and = vector<OrClause>();
17 }
18 
25 {
26  this->clauses_and.push_back(c);
27 }
28 
34 void SATFormulae::toSS(stringstream *ss) const
35 {
36  string newline = "\n";
37  for (int i = 0; i < (int) this->clauses_and.size(); i++)
38  {
39  (*ss) << this->clauses_and.at(i);
40  if (i != (int) this->clauses_and.size() - 1)
41  (*ss) << newline;
42  }
43 
44 }
45 
46 ostream& operator<<(ostream& out, const SATFormulae& r)
47 {
48  stringstream ss(stringstream::in | stringstream::out);
49  r.toSS(&ss);
50  out << ss.str();
51  return out;
52 }
53 
59 {
60  return (int) this->clauses_and.size();
61 }
62 
69 {
70  (*newsat) = SATFormulae();
71  for (int i = 0; i < this->size(); i++)
72  {
73  OrClause newor = OrClause();
74  this->clauses_and.at(i).clone(&newor);
75  (*newsat).appendOrClause(newor);
76  }
77 
78 }
79 
85 {
86  return this->clauses_and.empty();
87 }
88 
89 SATFormulae::~SATFormulae()
90 {
91 
92 }
93