cluster.h
Go to the documentation of this file.00001
00002
00003 #ifndef CLUSTER_H
00004 #define CLUSTER_H
00005
00006 #include <set>
00007
00008 #include <map>
00009 #include <string>
00010 #include <iostream>
00011 using namespace std;
00012
00013 class cluster
00014 {
00015 friend class clusmethod;
00016 public:
00017 cluster() {}
00018 cluster(int sd, const set<int> &tgs);
00019
00020
00021
00022
00023
00024 cluster(multimap<int, int> &mm);
00025 void addSeed(int sd) { set1.insert(sd); }
00026 void addTargets(const set<int> &ts) { set2.insert(ts.begin(), ts.end()); }
00027 void display(ostream &os=cout);
00028
00029
00030 string dumpArray() const;
00033 string toText(const char delimiter='\t') const;
00034
00035 set<int> getElements() const;
00036 int size() const { return set1.size() + set2.size(); }
00037
00038 friend ostream& operator<<(ostream &os, const cluster &c);
00039
00040 protected:
00041 set<int> set1;
00042 set<int> set2;
00043 };
00044
00045 #endif
00046 inline cluster::cluster(int sd, const set<int> &tgs) {
00047 set1.insert(sd);
00048 set2 = tgs;
00049 }
00050
00051 inline set<int> cluster::getElements() const {
00052 set<int> tmp(set1);
00053 tmp.insert(set2.begin(), set2.end());
00054 return tmp;
00055 }
00056