From: kjvdheide Date: Mon, 30 Oct 2017 11:50:05 +0000 (+0000) Subject: JAL-2795 foresterMatrix now stores distance values itself X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ed6eee466c185fbc257e9228da41678c6d527b02;p=jalview.git JAL-2795 foresterMatrix now stores distance values itself --- diff --git a/src/jalview/ext/forester/ForesterMatrix.java b/src/jalview/ext/forester/ForesterMatrix.java index d4864cf..0500704 100644 --- a/src/jalview/ext/forester/ForesterMatrix.java +++ b/src/jalview/ext/forester/ForesterMatrix.java @@ -17,27 +17,37 @@ public class ForesterMatrix implements DistanceMatrix private final static NumberFormat PHYLIP_FORMATTER = new DecimalFormat( "0.000000"); // straight from forester - private final MatrixI jalviewMatrix; - private final Sequence[] sequences; + private Sequence[] sequences; + + private int width; + + private int height; private final double[][] values; + private String[] identifiers; + public ForesterMatrix(MatrixI jalviewInputMatrix, Sequence[] matrixSequences) { - this.jalviewMatrix = jalviewInputMatrix; + width = jalviewInputMatrix.width(); + height = jalviewInputMatrix.height(); + values = new double[width][height]; + this.sequences = matrixSequences; - if (jalviewMatrix.width() != jalviewMatrix.height()) + + if (width != height) { // some kind of warning? } - values = new double[jalviewMatrix.width()][jalviewMatrix.height()]; + } + @Override public String getIdentifier(int i) { @@ -54,13 +64,13 @@ public class ForesterMatrix implements DistanceMatrix @Override public int getSize() { - return jalviewMatrix.width(); + return values.length; } @Override public double getValue(int col, int row) { - return jalviewMatrix.getValue(row, col); + return values[row][col]; } @Override @@ -73,7 +83,7 @@ public class ForesterMatrix implements DistanceMatrix @Override public void setValue(int col, int row, double distance) { - jalviewMatrix.setValue(row, col, distance); + values[row][col] = distance; } @@ -88,7 +98,7 @@ public class ForesterMatrix implements DistanceMatrix public double[][] getValues() { - return null; + return values; } @Override