5 #include "../../general/VectorUtility.h"
6 #include "../../general/debuglogObject.h"
7 #include "../../general/clustalw.h"
14 Node::Node(int _seqNum, double *dists, int numDist)
21 ptrToDistMatRow(dists),
22 minDist(numeric_limits<double>::max()),
27 allElements.resize(1);
28 allElements[0] = seqNum;
37 void Node::merge(Node **rightNode, double _height)
39 left = new Node(*this);
42 left->ptrToDistMatRow = 0;
43 size = left->size + right->size;
46 left->height = height;
47 right->height = height;
49 vectorutils::mergeVectors(&allElements, &(right->allElements));
50 right->allElements.clear();
58 *rightNode = right->next;
63 void Node::findMinDist()
65 double *distIterator = ptrToDistMatRow;
66 double *minDistSoFar = distIterator++;
68 // We search from the end of our area of the array
69 for(int i = numDists; --i; distIterator++) // When --i gets to zero it will stop
71 if ((*distIterator >= 0) && (*distIterator < *minDistSoFar))
73 minDistSoFar = distIterator;
77 minDist = *minDistSoFar;
78 indexToMinDist = minDistSoFar - ptrToDistMatRow;
81 void Node::printElements()
83 for(int i = 0; i < (int)allElements.size(); i++)
85 cout << " " << allElements[i];
90 string Node::elementsToString()
93 for(int i = 0; i < (int)allElements.size(); i++)
95 elems << " " << allElements[i];
100 void Node::makeEmpty()
105 void Node::makeEmpty(Node* t)