public static SymmetricalDistanceMatrixParser createInstance() { return new SymmetricalDistanceMatrixParser(); }
private SymmetricalDistanceMatrixParser() { init(); }
private void init() { setInputMatrixType( INPUT_MATRIX_TYPE_DEFAULT ); reset(); }
switch ( getInputMatrixType() ) { case LOWER_TRIANGLE: for( int col = 1; col <= row; ++col ) { transferValue( table, distance_matrix, row, col, start_row, 0 ); checkValueIsZero( table, row, row + 1, start_row ); break; case UPPER_TRIANGLE: for( int col = 1; col < ( table.getNumberOfColumns() - row ); ++col ) { transferValue( table, distance_matrix, row, col, start_row, row ); throw new AssertionError( "unkwnown input matrix type [" + getInputMatrixType() + "]" ); if ( getMatrixSize() < 1 ) { setMatrixSize( distance_matrix.getSize() ); else if ( getMatrixSize() != distance_matrix.getSize() ) { throw new IOException( "attempt to use matrices of unequal size: [" + getMatrixSize() + "] vs [" + distance_matrix.getSize() + "]" );
ForesterUtil.fatalError( PRG_NAME, "cannot write to outfile [" + outfile + "]: " + error2 ); final SymmetricalDistanceMatrixParser parser = SymmetricalDistanceMatrixParser.createInstance(); if ( upper_triangle ) { parser.setInputMatrixType( SymmetricalDistanceMatrixParser.InputMatrixType.UPPER_TRIANGLE ); parser.setInputMatrixType( SymmetricalDistanceMatrixParser.InputMatrixType.LOWER_TRIANGLE ); matrices = parser.parse( infile );
public DistanceMatrix[] parse( final Object source ) throws IOException { reset(); final List<BasicTable<String>> tables = BasicTableParser.parse( source, VALUE_SEPARATOR, false, false, COMMENT, true ); final DistanceMatrix[] distance_matrices = new DistanceMatrix[ tables.size() ]; int i = 0; for( final BasicTable<String> table : tables ) { distance_matrices[ i++ ] = transform( table ); } return distance_matrices; }
private void reset() { setMatrixSize( -1 ); }
source.append( l ); source.append( " " + l ); final SymmetricalDistanceMatrixParser p0 = SymmetricalDistanceMatrixParser.createInstance(); final DistanceMatrix[] ma0 = p0.parse( source.toString() ); if ( ma0.length != 3 ) { return false; source.append( " # 2 222 2 2 " + l ); source.append( " D 23 25 26 0" + l ); final DistanceMatrix[] ma1 = p0.parse( source.toString() ); if ( ma1.length != 3 ) { return false; source.append( "A 0" + l ); source.append( "B 10 0" + l ); final DistanceMatrix[] ma2 = p0.parse( source.toString() ); if ( ma2.length != 1 ) { return false; source.append( " " + l ); source.append( "#" + l ); final DistanceMatrix[] ma3 = p0.parse( source.toString() ); if ( ma3.length != 0 ) { return false; source.append( "C 0 26" + l ); source.append( "D 0" + l ); p0.setInputMatrixType( SymmetricalDistanceMatrixParser.InputMatrixType.UPPER_TRIANGLE ); final DistanceMatrix[] ma4 = p0.parse( source );