@Override public double hitRatio() { return MathUtil.portion( hits(), faults() ); }
public static int compareLongAgainstDouble( long lhs, double rhs ) { return - compareDoubleAgainstLong( rhs, lhs ); }
/** * Calculates the portion of the first value to all values passed * @param n The values in the set * @return the ratio of n[0] to the sum all n, 0 if result is {@link Double#NaN} */ public static double portion( double... n ) { assert n.length > 0; double first = n[0]; if ( numbersEqual( first, 0 ) ) { return 0d; } double total = Arrays.stream(n).sum(); return first / total; }
/** synchronized by all caller methods */ private void unmark() { marked = MathUtil.decrementExactNotPastZero( marked ); }
public int releaseReference() { return refCount = MathUtil.decrementExactNotPastZero( refCount ); }
/** * @return the ratio of page cache hits to total number of lookups or {@link Double#NaN} if no data is available */ default double getPageCacheHitRatio() { return MathUtil.portion( getPageCacheHits(), getPageCacheMisses() ); } }
@Test void numbersEqualShouldAlwaysBeFalseWhenComparingAgainstInfinities() { assertFalse( numbersEqual( Double.NEGATIVE_INFINITY, Long.MIN_VALUE ) ); assertFalse( numbersEqual( Double.POSITIVE_INFINITY, Long.MAX_VALUE ) ); } }
public static int compareLongAgainstDouble( long lhs, double rhs ) { return - compareDoubleAgainstLong( rhs, lhs ); }
void decrementRequests() { requests = MathUtil.decrementExactNotPastZero( requests ); }
/** * @return the ratio of page cache hits to total number of lookups or {@link Double#NaN} if no data is available */ default double getPageCacheHitRatio() { return MathUtil.portion( getPageCacheHits(), getPageCacheMisses() ); } }
@Test void numbersEqualShouldAlwaysBeFalseWhenComparingAgainstDoubleNaN() { assertFalse( numbersEqual( Double.NaN, 0 ) ); }
return MathUtil.compareDoubleAgainstLong( lhs.doubleValue(), rhs.longValue() ); return -MathUtil.compareDoubleAgainstLong( rhs.doubleValue(), lhs.longValue() );
totalWriteCount = MathUtil.decrementExactNotPastZero( totalWriteCount ); tle.writeCount = MathUtil.decrementExactNotPastZero( tle.writeCount ); if ( tle.isFree() )
@Override public double hitRatio() { return MathUtil.portion( hits(), faults() ); }
/** * Calculates the portion of the first value to all values passed * @param n The values in the set * @return the ratio of n[0] to the sum all n, 0 if result is {@link Double#NaN} */ public static double portion( double... n ) { assert n.length > 0; double first = n[0]; if ( numbersEqual( first, 0 ) ) { return 0d; } double total = Arrays.stream(n).sum(); return first / total; }
totalReadCount = MathUtil.decrementExactNotPastZero( totalReadCount ); tle.readCount = MathUtil.decrementExactNotPastZero( tle.readCount ); if ( tle.isFree() )
default double pageCacheHitRatio() { return ( pageCacheHits() == NO_DATA || pageCacheMisses() == NO_DATA ) ? NO_DATA : MathUtil.portion( pageCacheHits(), pageCacheMisses() ); }
/** synchronized by all caller methods */ private void unmark() { marked = MathUtil.decrementExactNotPastZero( marked ); }
@Override public double hitRatio() { return MathUtil.portion( hits(), faults() ); } }
void decrementRequests() { requests = MathUtil.decrementExactNotPastZero( requests ); }