/** * Calculates the percentage for the given value in the range denoted by the * given lower and upper bounds. * * @param aValue * the value; * @param aLowerBound * the lower bound of the range; * @param aUpperBound * the upper bound of the range. * @return the percentage (= value * 100.0 / range). */ public static int getPercentage( final long aValue, final long aLowerBound, final long aUpperBound ) { long range; long value = aValue; if ( aLowerBound > aUpperBound ) { range = aLowerBound - aUpperBound; value = Math.max( 0, value - aUpperBound ); } else { range = aUpperBound - aLowerBound; value = Math.max( 0, value - aLowerBound ); } return getPercentage( value, range ); }
/** * Calculates the percentage for the given value in the range denoted by the * given lower and upper bounds. * * @param aValue * the value; * @param aLowerBound * the lower bound of the range; * @param aUpperBound * the upper bound of the range. * @return the percentage (= value * 100.0 / range). */ public static int getPercentage( final int aValue, final int aLowerBound, final int aUpperBound ) { int range; int value = aValue; if ( aLowerBound > aUpperBound ) { range = aLowerBound - aUpperBound; value = Math.max( 0, value - aUpperBound ); } else { range = aUpperBound - aLowerBound; value = Math.max( 0, value - aLowerBound ); } return getPercentage( value, range ); }
this.progressListener.setProgress( getPercentage( sampleIdx, aStartOfDecode, aEndOfDecode ) ); this.progressListener.setProgress( getPercentage( sampleIdx, aStartOfDecode, aEndOfDecode ) );
this.progressListener.setProgress( getPercentage( idx, startOfDecode, endOfDecode ) );
this.progressListener.setProgress( getPercentage( i, startSampleIdx, endSampleIdx ) );
.setProgress( getPercentage( idx, i2cDataSet.getStartOfDecode(), i2cDataSet.getEndOfDecode() ) );
this.progressListener.setProgress( getPercentage( idx, startOfDecode, endOfDecode ) );
this.progressListener.setProgress( getPercentage( time, startOfDecode, endOfDecode ) );
setProgress( getPercentage( start, startOfDecode, endOfDecode ) );