cluster.h

Go to the documentation of this file.
00001 // cluster.h
00002 
00003 #ifndef CLUSTER_H
00004 #define CLUSTER_H
00005 
00006 #include <set>
00007 //#include <multimap.h>
00008 #include <map>              // now map includes multimap
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                 /* constructs a new cluster from
00021                  * the first key->values, and removed
00022                  * the key and associated values from mm
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);  // diagnostic function
00028 
00029                 /* produce array in the format of postgres */
00030                 string dumpArray() const;  
00033                 string toText(const char delimiter='\t') const;
00034 
00035          set<int> getElements() const;  //combine set1 and set2
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;  // the seed set
00042                 set<int> set2;  // the target set
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         

Generated on Wed Oct 14 21:49:10 2009 for Softwares from Orpara by  doxygen 1.5.6