/** {@inheritDoc} */ protected void rehash( int newCapacity ) { int oldCapacity = _set.length; double oldKeys[] = _set; int oldVals[] = _values; byte oldStates[] = _states; _set = new double[newCapacity]; _values = new int[newCapacity]; _states = new byte[newCapacity]; for ( int i = oldCapacity; i-- > 0; ) { if( oldStates[i] == FULL ) { double o = oldKeys[i]; int index = insertKey( o ); _values[index] = oldVals[i]; } } }
/** {@inheritDoc} */ public int put( double key, int value ) { int index = insertKey( key ); return doPut( key, value, index ); }
/** {@inheritDoc} */ public int putIfAbsent( double key, int value ) { int index = insertKey( key ); if (index < 0) return _values[-index - 1]; return doPut( key, value, index ); }
/** {@inheritDoc} */ public int adjustOrPutValue( double key, int adjust_amount, int put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final int 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; double oldKeys[] = _set; int oldVals[] = _values; byte oldStates[] = _states; _set = new double[newCapacity]; _values = new int[newCapacity]; _states = new byte[newCapacity]; for ( int i = oldCapacity; i-- > 0; ) { if( oldStates[i] == FULL ) { double o = oldKeys[i]; int index = insertKey( o ); _values[index] = oldVals[i]; } } }
/** {@inheritDoc} */ @Override protected void rehash( int newCapacity ) { int oldCapacity = _set.length; double oldKeys[] = _set; int oldVals[] = _values; byte oldStates[] = _states; _set = new double[newCapacity]; _values = new int[newCapacity]; _states = new byte[newCapacity]; for ( int i = oldCapacity; i-- > 0; ) { if( oldStates[i] == FULL ) { double o = oldKeys[i]; int index = insertKey( o ); _values[index] = oldVals[i]; } } }
/** {@inheritDoc} */ protected void rehash( int newCapacity ) { int oldCapacity = _set.length; double oldKeys[] = _set; int oldVals[] = _values; byte oldStates[] = _states; _set = new double[newCapacity]; _values = new int[newCapacity]; _states = new byte[newCapacity]; for ( int i = oldCapacity; i-- > 0; ) { if( oldStates[i] == FULL ) { double o = oldKeys[i]; int index = insertKey( o ); _values[index] = oldVals[i]; } } }
/** {@inheritDoc} */ public int put( double key, int value ) { int index = insertKey( key ); return doPut( key, value, index ); }
/** {@inheritDoc} */ @Override public int putIfAbsent( double key, int value ) { int index = insertKey( key ); if (index < 0) return _values[-index - 1]; return doPut( key, value, index ); }
/** {@inheritDoc} */ @Override public int put( double key, int value ) { int index = insertKey( key ); return doPut( key, value, index ); }
/** {@inheritDoc} */ public int putIfAbsent( double key, int value ) { int index = insertKey( key ); if (index < 0) return _values[-index - 1]; return doPut( key, value, index ); }
/** {@inheritDoc} */ public int putIfAbsent( double key, int value ) { int index = insertKey( key ); if (index < 0) return _values[-index - 1]; return doPut( key, value, index ); }
/** {@inheritDoc} */ public int put( double key, int value ) { int index = insertKey( key ); return doPut( key, value, index ); }
/** {@inheritDoc} */ public int adjustOrPutValue( double key, int adjust_amount, int put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final int 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 int adjustOrPutValue( double key, int adjust_amount, int put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final int 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 int adjustOrPutValue( double key, int adjust_amount, int put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final int 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; }