- * Merges cluster(j) to cluster(i) and recalculates cluster and node distances
- *
- * @param i
- * @param j
- */
- void joinClusters(final int i, final int j)
- {
- double dist = distances.getValue(i, j);
-
- /*
- * add the members of cluster(j) to cluster(i)
- */
- clusters.get(i).or(clusters.get(j));
-
- ri = findr(i, j);
- rj = findr(j, i);
-
- findClusterDistance(i, j);
-
- SequenceNode sn = new SequenceNode();
-
- sn.setLeft((node.elementAt(i)));
- sn.setRight((node.elementAt(j)));
-
- SequenceNode tmpi = (node.elementAt(i));
- SequenceNode tmpj = (node.elementAt(j));
-
- findNewDistances(tmpi, tmpj, dist);
-
- tmpi.setParent(sn);
- tmpj.setParent(sn);
-
- node.setElementAt(sn, i);
-
- /*
- * mark cluster j as disposed of
- */
- done.set(j);
- clusters.setElementAt(null, j);
- }
-
- protected abstract void findNewDistances(SequenceNode tmpi, SequenceNode tmpj,
- double dist);
-
- /**
- * Calculates and saves the distance between the combination of cluster(i) and
- * cluster(j) and all other clusters. The form of the calculation depends on
- * the tree clustering method being used.
- *
- * @param i
- * @param j
- */
- protected abstract void findClusterDistance(int i, int j);
-
- /**