X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAverageDistanceTree.java;h=760962e988682adecbcbbfbbb5a03e9f94cf2723;hb=078d3939810e3be7d0ed9452df7db6b29e7b8e70;hp=907109e6d39a6429fc3cb9643efe9297fcc95920;hpb=21d7606604dab27e62ed700a39425b983901cef1;p=jalview.git diff --git a/src/jalview/analysis/AverageDistanceTree.java b/src/jalview/analysis/AverageDistanceTree.java index 907109e..760962e 100644 --- a/src/jalview/analysis/AverageDistanceTree.java +++ b/src/jalview/analysis/AverageDistanceTree.java @@ -1,8 +1,28 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.analysis; import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.SimilarityParamsI; -import jalview.datamodel.SequenceNode; +import jalview.datamodel.BinaryNode; import jalview.viewmodel.AlignmentViewport; /** @@ -46,8 +66,8 @@ public class AverageDistanceTree extends TreeBuilder { if ((l != i) && (l != j)) { - newdist[l] = ((distances.getValue(i, l) * noi) + (distances - .getValue(j, l) * noj)) / (noi + noj); + newdist[l] = ((distances.getValue(i, l) * noi) + + (distances.getValue(j, l) * noj)) / (noi + noj); } else { @@ -93,25 +113,25 @@ public class AverageDistanceTree extends TreeBuilder * {@inheritDoc} */ @Override - protected void findNewDistances(SequenceNode nodei, SequenceNode nodej, + protected void findNewDistances(BinaryNode nodei, BinaryNode nodej, double dist) { double ih = 0; double jh = 0; - SequenceNode sni = nodei; - SequenceNode snj = nodej; + BinaryNode sni = nodei; + BinaryNode snj = nodej; while (sni != null) { ih = ih + sni.dist; - sni = (SequenceNode) sni.left(); + sni = (BinaryNode) sni.left(); } while (snj != null) { jh = jh + snj.dist; - snj = (SequenceNode) snj.left(); + snj = (BinaryNode) snj.left(); } nodei.dist = ((dist / 2) - ih);