(no commit message)
[jalview.git] / forester / java / src / org / forester / io / parsers / SymmetricalDistanceMatrixParser.java
index 538257c..c527140 100644 (file)
@@ -22,7 +22,7 @@
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 //
 // Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
 
 package org.forester.io.parsers;
 
@@ -39,23 +39,23 @@ import org.forester.util.ForesterUtil;
  * This can read full, lower triangular, and upper triangular distance matrices.
  * In the case of a full matrix, the lower triangular values are used. Format
  * (by example): id1 0 id2 0.3 0 id3 0.4 0.4 0
- * 
+ *
  * OR
- * 
+ *
  * id1 id2 0.3 id3 0.4 0.4
- * 
+ *
  * Numbers before are after the data are ignored.
- * 
- * 
- * 
- * 
+ *
+ *
+ *
+ *
  * @author Christian M Zmasek
  */
 public class SymmetricalDistanceMatrixParser {
 
     private final static InputMatrixType INPUT_MATRIX_TYPE_DEFAULT = InputMatrixType.LOWER_TRIANGLE;
     private final static String          COMMENT                   = "#";
-    private final static String          VALUE_SEPARATOR           = " ";
+    private final static char            VALUE_SEPARATOR           = ' ';
     private int                          _matrix_size;
     private InputMatrixType              _input_matrix_type;
 
@@ -75,11 +75,11 @@ public class SymmetricalDistanceMatrixParser {
         }
         catch ( final NumberFormatException e ) {
             throw new IOException( "illegal format for distance [" + table_value + "] at [" + ( i - 1 ) + ", " + row
-                    + "]" );
+                                   + "]" );
         }
         if ( !ForesterUtil.isEqual( 0.0, d ) ) {
             throw new IOException( "attempt to use non-zero diagonal value [" + table_value + "] at [" + ( i - 1 )
-                    + ", " + row + "]" );
+                                   + ", " + row + "]" );
         }
     }
 
@@ -140,9 +140,9 @@ public class SymmetricalDistanceMatrixParser {
         }
         catch ( final NumberFormatException e ) {
             throw new IOException( "illegal format for distance [" + table_value + "] at [" + ( col - 1 ) + ", " + row
-                    + "]" );
+                                   + "]" );
         }
-        distance_matrix.setValue( col - 1 + col_offset, row, d );
+        distance_matrix.setValue( ( col - 1 ) + col_offset, row, d );
     }
 
     private DistanceMatrix transform( final BasicTable<String> table ) throws IllegalArgumentException, IOException {
@@ -154,7 +154,7 @@ public class SymmetricalDistanceMatrixParser {
         if ( table.getNumberOfColumns() == table.getNumberOfRows() ) {
             first_line_is_size = true;
         }
-        else if ( table.getNumberOfColumns() != table.getNumberOfRows() + 1 ) {
+        else if ( table.getNumberOfColumns() != ( table.getNumberOfRows() + 1 ) ) {
             throw new IllegalArgumentException( "attempt to create distance matrix with illegal dimensions [columns: "
                     + table.getNumberOfColumns() + ", rows: " + table.getNumberOfRows() + "]" );
         }
@@ -163,7 +163,7 @@ public class SymmetricalDistanceMatrixParser {
         if ( first_line_is_size ) {
             start_row = 1;
         }
-        for( int row = 0; row < table.getNumberOfRows() - start_row; row++ ) {
+        for( int row = 0; row < ( table.getNumberOfRows() - start_row ); row++ ) {
             distance_matrix.setIdentifier( row, table.getValue( 0, row + start_row ) );
             switch ( getInputMatrixType() ) {
                 case LOWER_TRIANGLE: