28 lines
601 B
C
28 lines
601 B
C
|
#ifndef __RULE_H__
|
||
|
#define __RULE_H__
|
||
|
|
||
|
#include "predicate.h"
|
||
|
#include <vector>
|
||
|
#include <iostream>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
class rule {
|
||
|
public:
|
||
|
predicate head;
|
||
|
vector<predicate> pred_rule;
|
||
|
string toString() {
|
||
|
stringstream s;
|
||
|
s << head.toString(1) << " :- ";
|
||
|
for(unsigned int i = 0; i < pred_rule.size(); i++) {
|
||
|
s << pred_rule[i].toString(1);
|
||
|
if(i < pred_rule.size()-1) {
|
||
|
s << ",";
|
||
|
}
|
||
|
}
|
||
|
s << ".\n";
|
||
|
return s.str();
|
||
|
}
|
||
|
};
|
||
|
#endif
|