/** {@inheritDoc} */ protected void rehash( int newCapacity ) { int oldCapacity = _set.length; long oldKeys[] = _set; float oldVals[] = _values; byte oldStates[] = _states; _set = new long[newCapacity]; _values = new float[newCapacity]; _states = new byte[newCapacity]; for ( int i = oldCapacity; i-- > 0; ) { if( oldStates[i] == FULL ) { long o = oldKeys[i]; int index = insertKey( o ); _values[index] = oldVals[i]; } } }
/** {@inheritDoc} */ public float put( long key, float value ) { int index = insertKey( key ); return doPut( key, value, index ); }
/** {@inheritDoc} */ public float putIfAbsent( long key, float value ) { int index = insertKey( key ); if (index < 0) return _values[-index - 1]; return doPut( key, value, index ); }
/** {@inheritDoc} */ public float adjustOrPutValue( long key, float adjust_amount, float put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final float newValue; if ( index < 0 ) { index = -index -1; newValue = ( _values[index] += adjust_amount ); isNewMapping = false; } else { newValue = ( _values[index] = put_amount ); isNewMapping = true; } byte previousState = _states[index]; if ( isNewMapping ) { postInsertHook(consumeFreeSlot); } return newValue; }
/** {@inheritDoc} */ protected void rehash( int newCapacity ) { int oldCapacity = _set.length; long oldKeys[] = _set; float oldVals[] = _values; byte oldStates[] = _states; _set = new long[newCapacity]; _values = new float[newCapacity]; _states = new byte[newCapacity]; for ( int i = oldCapacity; i-- > 0; ) { if( oldStates[i] == FULL ) { long o = oldKeys[i]; int index = insertKey( o ); _values[index] = oldVals[i]; } } }
/** {@inheritDoc} */ protected void rehash( int newCapacity ) { int oldCapacity = _set.length; long oldKeys[] = _set; float oldVals[] = _values; byte oldStates[] = _states; _set = new long[newCapacity]; _values = new float[newCapacity]; _states = new byte[newCapacity]; for ( int i = oldCapacity; i-- > 0; ) { if( oldStates[i] == FULL ) { long o = oldKeys[i]; int index = insertKey( o ); _values[index] = oldVals[i]; } } }
/** {@inheritDoc} */ @Override protected void rehash( int newCapacity ) { int oldCapacity = _set.length; long oldKeys[] = _set; float oldVals[] = _values; byte oldStates[] = _states; _set = new long[newCapacity]; _values = new float[newCapacity]; _states = new byte[newCapacity]; for ( int i = oldCapacity; i-- > 0; ) { if( oldStates[i] == FULL ) { long o = oldKeys[i]; int index = insertKey( o ); _values[index] = oldVals[i]; } } }
/** {@inheritDoc} */ public float put( long key, float value ) { int index = insertKey( key ); return doPut( key, value, index ); }
/** {@inheritDoc} */ public float put( long key, float value ) { int index = insertKey( key ); return doPut( key, value, index ); }
/** {@inheritDoc} */ public float putIfAbsent( long key, float value ) { int index = insertKey( key ); if (index < 0) return _values[-index - 1]; return doPut( key, value, index ); }
/** {@inheritDoc} */ @Override public float put( long key, float value ) { int index = insertKey( key ); return doPut( key, value, index ); }
/** {@inheritDoc} */ @Override public float putIfAbsent( long key, float value ) { int index = insertKey( key ); if (index < 0) return _values[-index - 1]; return doPut( key, value, index ); }
/** {@inheritDoc} */ public float putIfAbsent( long key, float value ) { int index = insertKey( key ); if (index < 0) return _values[-index - 1]; return doPut( key, value, index ); }
/** {@inheritDoc} */ public float adjustOrPutValue( long key, float adjust_amount, float put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final float newValue; if ( index < 0 ) { index = -index -1; newValue = ( _values[index] += adjust_amount ); isNewMapping = false; } else { newValue = ( _values[index] = put_amount ); isNewMapping = true; } byte previousState = _states[index]; if ( isNewMapping ) { postInsertHook(consumeFreeSlot); } return newValue; }
/** {@inheritDoc} */ @Override public float adjustOrPutValue( long key, float adjust_amount, float put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final float newValue; if ( index < 0 ) { index = -index -1; newValue = ( _values[index] += adjust_amount ); isNewMapping = false; } else { newValue = ( _values[index] = put_amount ); isNewMapping = true; } if ( isNewMapping ) { postInsertHook(consumeFreeSlot); } return newValue; }
/** {@inheritDoc} */ public float adjustOrPutValue( long key, float adjust_amount, float put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final float newValue; if ( index < 0 ) { index = -index -1; newValue = ( _values[index] += adjust_amount ); isNewMapping = false; } else { newValue = ( _values[index] = put_amount ); isNewMapping = true; } byte previousState = _states[index]; if ( isNewMapping ) { postInsertHook(consumeFreeSlot); } return newValue; }