From eeb51330a8c0ad188e7b07597e66cbe090d9d160 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Mon, 30 Oct 2017 13:48:16 +0000 Subject: [PATCH] JAL-2795 added comments links from ForesterMatrix to MatrixI --- src/jalview/ext/forester/ForesterMatrix.java | 17 +++++++++++++++-- src/jalview/math/Matrix.java | 1 + src/jalview/math/MatrixI.java | 8 +++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/jalview/ext/forester/ForesterMatrix.java b/src/jalview/ext/forester/ForesterMatrix.java index f8b68d0..daeec3b 100644 --- a/src/jalview/ext/forester/ForesterMatrix.java +++ b/src/jalview/ext/forester/ForesterMatrix.java @@ -21,7 +21,6 @@ public class ForesterMatrix implements DistanceMatrix private Sequence[] sequences; - private String[] identifiers; public ForesterMatrix(MatrixI jalviewInputMatrix, @@ -66,12 +65,19 @@ public class ForesterMatrix implements DistanceMatrix return 0; } + /** + * Returns the length of whichever is longest, columns or rows + */ @Override public int getSize() { - return jalviewMatrix.width(); + return jalviewMatrix.getValues().length; } + /** + * See {@link MatrixI#getValue(int,int)} except that the order of column, row + * in the parameters is inverted here + */ @Override public double getValue(int col, int row) { @@ -85,6 +91,10 @@ public class ForesterMatrix implements DistanceMatrix } + /** + * See {@link MatrixI#setValue()} except that the order of column, row in the + * parameters is inverted here + */ @Override public void setValue(int col, int row, double distance) { @@ -99,6 +109,9 @@ public class ForesterMatrix implements DistanceMatrix return null; } + /** + * See {@link MatrixI#getValues()} + */ @Override public double[][] getValues() { diff --git a/src/jalview/math/Matrix.java b/src/jalview/math/Matrix.java index 21c5a4d..5c264a8 100755 --- a/src/jalview/math/Matrix.java +++ b/src/jalview/math/Matrix.java @@ -996,6 +996,7 @@ public class Matrix implements MatrixI } } + @Override public double[][] getValues() { diff --git a/src/jalview/math/MatrixI.java b/src/jalview/math/MatrixI.java index f4d5030..840e93b 100644 --- a/src/jalview/math/MatrixI.java +++ b/src/jalview/math/MatrixI.java @@ -48,7 +48,7 @@ public interface MatrixI double getValue(int i, int j); /** - * Sets the value at row i, colum j + * Sets the value at row i, column j * * @param i * @param j @@ -63,6 +63,12 @@ public interface MatrixI */ double[] getRow(int i); + /** + * Answers all values present in the Matrix ordered by row,column + * + * @return the double array containing the values ordered in {row values} per + * column + */ double[][] getValues(); -- 1.7.10.2