* 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;
}
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 + "]" );
}
}
}
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 );
}