### Profile

Statistics
| Branch: | Revision:

## cool / src / lib / GMLMIP-0.1 / rules / node.cpp @ 7c4d2eb4

 1 ```#include "node.h" ``` ```void Node::allow(int a){ ``` ``` valuations[a] = 1; ``` ```} ``` ```void Node::disallow(int d){ ``` ``` valuations[d] = 0; ``` ```} ``` ```Node::Node(int no_of_atoms) : size (static_cast(pow(2, no_of_atoms))), valuations(size, 0){ ``` ``` //valuations.resize(size, 0); ``` ``` // needs to be replaced with actually initing the stuff ``` ``` //for(int i=0; i < size; i++) ``` ``` //valuations[i]=0; ``` ```} ``` ```bool Node::operator==(const Node& other) const{ ``` ``` if(size == other.size){ ``` ``` for(int i=0; i < size; i++) ``` ``` if(valuations[i] != other.valuations[i]) ``` ``` return false; ``` ``` return true; ``` ``` } ``` ``` return false; ``` ```} ``` ```bool Node::operator<(const Node& other) const{ ``` ``` if(size == other.size){ ``` ``` for(int i=0; i < size; i++) ``` ``` if(valuations[i]==1 && other.valuations[i]==0) ``` ``` return false; ``` ``` return true; ``` ``` } ``` ``` cout << "you checked for supersets with nodes of different sizes - you probably didn't mean to do this..." << endl; ``` ``` return false; ``` ```} ``` ```ostream& operator<<(ostream& out, const Node& n){ ``` ``` out << n.size << endl; ``` ``` for(int i=0; i < n.size; i++) ``` ``` out << n.valuations[i] << " "; ``` ``` out << endl; ``` ```} ```