- private final void updateDvalue( final int otu1, final int otu2, final int i, final double d ) {
- setDvalue( otu1, i, ( getDvalue( otu1, i ) + getDvalue( i, otu2 ) - d ) / 2 );
+ private final void updateDvalue( final int otu1, final int otu2, final int j, final double d ) {
+ final double new_d = ( getDvalueUnmapped( otu1, _mappings[ j ] ) + getDvalue( j, otu2 ) - d ) / 2;
+ System.out.print( DF.format( new_d ) + " " );
+ // System.out.println( "going to remove: " + getDvalueUnmapped( otu1, _mappings[ j ] ) + ", " + otu1 + ", "
+ // + _mappings[ j ] );
+
+ if ( otu1< _mappings[ j ] ) {
+ _s.removePairing( getDvalueUnmapped( otu1, _mappings[ j ] ), otu1, _mappings[ j ] );
+ }
+ else {
+ _s.removePairing( getDvalueUnmapped( otu1, _mappings[ j ] ), _mappings[ j ] , otu1 );
+ }
+
+
+ // System.out.println( "going to remove: " + getDvalue( j, otu2 ) + ", " +_mappings[ otu2 ] + ", "
+ // + _mappings[ j ] );
+
+ if ( _mappings[ otu2 ] < _mappings[ j ] ) {
+ _s.removePairing( getDvalue( j, otu2 ), _mappings[ otu2 ] , _mappings[ j ] );
+ }
+ else {
+ _s.removePairing( getDvalue( j, otu2 ) , _mappings[ j ], _mappings[ otu2 ] );
+
+ }
+
+ _s.addPairing( new_d, otu1, _mappings[ j ] );
+ setDvalueU( otu1, j, new_d );