Go to the documentation of this file.00001
00007 #include <stdlib.h>
00008 #include <vector>
00009 #include <string>
00010 #include <sstream>
00011 #include <iostream>
00012
00013 #include "clause.h"
00014
00015 using namespace cnf;
00016
00017
00018 Clause::Clause()
00019 {
00020 literals.clear();
00021 }
00022
00023 void Clause::addLit(int code)
00024 {
00025 literals.push_back(code);
00026 }
00027
00028 std::string Clause::toString()
00029 {
00030 std::stringstream s(std::stringstream::out);
00031 for (unsigned int i=0; i<literals.size(); i++)
00032 {
00033 s << literals[i] << " ";
00034 }
00035 std::string res = s.str() + "0";
00036 s.flush();
00037 return res;
00038 }
00039
00040 void Clause::clear()
00041 {
00042 literals.clear();
00043 }