public void subtract ( final DoubleHistogram otherHistogram ) { int arrayLength = otherHistogram . integerValuesHistogram . countsArrayLength ; AbstractHistogram otherIntegerHistogram = otherHistogram . integerValuesHistogram ; for ( int i = 0 ; i < arrayLength ; i ++ ) { long otherCount = otherIntegerHistogram . getCountAtIndex ( i ) ; if ( otherCount > 0 ) { double otherValue = otherIntegerHistogram . valueFromIndex ( i ) * otherHistogram . integerToDoubleValueConversionRatio ; if ( getCountAtValue ( otherValue ) < otherCount ) { throw new IllegalArgumentException ( "otherHistogram count (" + otherCount + ") at value " + otherValue + " is larger than this one's (" + getCountAtValue ( otherValue ) + ")" ) ; } recordValueWithCount ( otherValue , - otherCount ) ; } } }
Subtract the contents of another histogram from this one .