question: public final double doOperation ( ) { final int dim = parameter . getDimension ( ) ; double sum = 0.0 ; if ( usesPriorOnSum ) { for ( int i = 0 ; i < dim ; i ++ ) { sum += Math . abs ( parameter . getParameterValue ( i ) ) ; } } final int pos = MathUtils . nextInt ( dim ) ; final int value = ( int ) parameter . getParameterValue ( pos ) ; double logq = 0.0 ; if ( value == 0 ) { logq = bitFlipHelper . flipZero ( pos , dim , sum ) ; } else if ( value == 1 ) { logq = bitFlipHelper . flipOne ( pos , dim , sum ) ; } else if ( value == - 1 ) { logq = bitFlipHelper . flipNegOne ( pos , dim , sum ) ; } else { throw new RuntimeException ( "expected 1 or 0 or -1" ) ; } if ( ! usesPriorOnSum ) { logq = 0 ; } return logq ; }
target:  Change the parameter and return the hastings ratio. Flip (Switch a 0 to 1 or 1 to 0) for a random bit in a bit vector. Return the hastings ratio which makes all subsets of vectors with the same number of 1 bits equiprobable, unless usesPriorOnSum = false then all configurations are equiprobable