#ifndef __RELACIJA_H__
#define __RELACIJA_H__

#include <set>
#include <vector>
#include <algorithm>
using namespace std;

class Relacija {
 public:
    void dodaj(const vector<int>& element) {
	_podaci.push_back(element);
    }

    bool uRelaciji(const vector<int>& element) {
	return find(_podaci.begin(), _podaci.end(), element) != _podaci.end();
    }

    bool korektna(const vector< set<int> >& domeni ) {
	int n = domeni.size();
	vector< vector<int> >::const_iterator it;
	for (it = _podaci.begin(); it != _podaci.end(); it++) {
	    if (it->size() != n)
		return false;
	    for (int i = 0; i < n; i++) {
		if (domeni[i].find((*it)[i]) == domeni[i].end())
		    return false;
	    }
	}
	return true;
    }
 private:
    vector< vector<int> > _podaci;
};
#endif
