Mac binaries
[jabaws.git] / website / archive / binaries / mac / src / muscle / cluster.h
diff --git a/website/archive/binaries/mac/src/muscle/cluster.h b/website/archive/binaries/mac/src/muscle/cluster.h
new file mode 100644 (file)
index 0000000..520dce1
--- /dev/null
@@ -0,0 +1,86 @@
+class DistFunc;\r
+\r
+class ClusterNode\r
+       {\r
+       friend class ClusterTree;\r
+public:\r
+       ClusterNode()\r
+               {\r
+               m_dWeight = 0.0;\r
+               m_dWeight2 = 0.0;\r
+               m_ptrLeft = 0;\r
+               m_ptrRight = 0;\r
+               m_ptrParent = 0;\r
+               m_uIndex = 0;\r
+               m_ptrPrevDisjoint = 0;\r
+               m_ptrNextDisjoint = 0;\r
+               }\r
+       ~ClusterNode() {}\r
+\r
+public:\r
+       unsigned GetIndex() const { return m_uIndex; }\r
+       ClusterNode *GetLeft() const { return m_ptrLeft; }\r
+       ClusterNode *GetRight() const { return m_ptrRight; }\r
+       ClusterNode *GetParent() const { return m_ptrParent; }\r
+       double GetWeight() const { return m_dWeight; }\r
+\r
+       const ClusterNode *GetClusterLeaf(unsigned uLeafIndex) const;\r
+       unsigned GetClusterSize() const;\r
+       double GetClusterWeight() const;\r
+       double GetLeftBranchWeight() const;\r
+       double GetRightBranchWeight() const;\r
+       double GetLeftWeight() const;\r
+       double GetRightWeight() const;\r
+\r
+       void LogMe() const;\r
+\r
+       double GetWeight2() const { return m_dWeight2; }\r
+       void SetWeight2(double dWeight2) { m_dWeight2 = dWeight2; }\r
+\r
+protected:\r
+       void SetIndex(unsigned uIndex) { m_uIndex = uIndex; }\r
+       void SetWeight(double dWeight) { m_dWeight = dWeight; }\r
+       void SetLeft(ClusterNode *ptrLeft) { m_ptrLeft = ptrLeft; }\r
+       void SetRight(ClusterNode *ptrRight) { m_ptrRight = ptrRight; }\r
+       void SetParent(ClusterNode *ptrParent) { m_ptrParent = ptrParent; }\r
+       void SetNextDisjoint(ClusterNode *ptrNode) { m_ptrNextDisjoint = ptrNode; }\r
+       void SetPrevDisjoint(ClusterNode *ptrNode) { m_ptrPrevDisjoint = ptrNode; }\r
+\r
+       ClusterNode *GetNextDisjoint() { return m_ptrNextDisjoint; }\r
+       ClusterNode *GetPrevDisjoint() { return m_ptrPrevDisjoint; }\r
+\r
+private:\r
+       double m_dWeight;\r
+       double m_dWeight2;\r
+       unsigned m_uIndex;\r
+       ClusterNode *m_ptrLeft;\r
+       ClusterNode *m_ptrRight;\r
+       ClusterNode *m_ptrParent;\r
+       ClusterNode *m_ptrNextDisjoint;\r
+       ClusterNode *m_ptrPrevDisjoint;\r
+       };\r
+\r
+class ClusterTree\r
+       {\r
+public:\r
+       ClusterTree();\r
+       virtual ~ClusterTree();\r
+\r
+       void Create(const DistFunc &DF);\r
+\r
+       ClusterNode *GetRoot() const;\r
+       void LogMe() const;\r
+\r
+protected:\r
+       void Join(ClusterNode *ptrNode1, ClusterNode *ptrNode2,\r
+         ClusterNode *ptrJoin);\r
+       void AddToDisjoints(ClusterNode *ptrNode);\r
+       void DeleteFromDisjoints(ClusterNode *ptrNode);\r
+       void Validate(unsigned uNodeCount);\r
+\r
+private:\r
+       ClusterNode *m_ptrDisjoints;\r
+       ClusterNode *m_Nodes;\r
+       unsigned m_uNodeCount;\r
+       unsigned m_uLeafCount;\r
+       };\r