public double adjustOrPutValue( short key, double adjust_amount, double put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
public boolean adjustValue( short key, double amount ) { synchronized( mutex ) { return m.adjustValue( key, amount ); } } public double adjustOrPutValue( short key, double adjust_amount, double put_amount ) {
/** * Empties the map. */ public void clear() { this._map.clear(); }
/** * Checks for the present of <tt>key</tt> in the keys of the map. * * @param key an <code>Object</code> value * @return a <code>boolean</code> value */ public boolean containsKey( Object key ) { if ( key == null ) return _map.containsKey( _map.getNoEntryKey() ); return key instanceof Short && _map.containsKey( unwrapKey( key ) ); }
/** * Retrieves the value for <tt>key</tt> * * @param key an <code>Object</code> value * @return the value of <tt>key</tt> or null if no such mapping exists. */ public Double get( Object key ) { short k; if ( key != null ) { if ( key instanceof Short ) { k = unwrapKey( key ); } else { return null; } } else { k = _map.getNoEntryKey(); } double v = _map.get( k ); // There may be a false positive since primitive maps // cannot return null, so we have to do an extra // check here. if ( v == _map.getNoEntryValue() ) { return null; } else { return wrapValue( v ); } }
/** * Deletes a key/value pair from the map. * * @param key an <code>Object</code> value * @return the removed value, or null if it was not found in the map */ public Double remove( Object key ) { short k; if ( key != null ) { if ( key instanceof Short ) { k = unwrapKey( key ); } else { return null; } } else { k = _map.getNoEntryKey(); } double v = _map.remove( k ); // There may be a false positive since primitive maps // cannot return null, so we have to do an extra // check here. if ( v == _map.getNoEntryValue() ) { return null; } else { return wrapValue( v ); } }
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TShortDoubleMap ) ) { return false; } TShortDoubleMap that = ( TShortDoubleMap ) other; if ( that.size() != this.size() ) { return false; } double[] values = _values; byte[] states = _states; double this_no_entry_value = getNoEntryValue(); double that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { short key = _set[i]; double that_value = that.get( key ); double this_value = values[i]; if ( ( this_value != that_value ) && ( this_value != this_no_entry_value ) && ( that_value != that_no_entry_value ) ) { return false; } } } return true; }
/** * Inserts a key/value pair into the map. * * @param key an <code>Object</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or Double(0) if none was found. */ public Double put( Short key, Double value ) { short k; double v; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } if ( value == null ) { v = _map.getNoEntryValue(); } else { v = unwrapValue( value ); } double retval = _map.put( k, v ); if ( retval == _map.getNoEntryValue() ) { return null; } return wrapValue( retval ); }
public boolean containsValue( double value ){ synchronized( mutex ) { return m.containsValue( value ); } } public double get( short key ) {
public boolean forEachKey( TShortProcedure procedure ) { return m.forEachKey( procedure ); } public boolean forEachValue( TDoubleProcedure procedure ) {
public boolean forEachValue( TDoubleProcedure procedure ) { synchronized( mutex ) { return m.forEachValue( procedure ); } } public boolean forEachEntry( TShortDoubleProcedure procedure ) {
public double get( short key ) { synchronized( mutex ) { return m.get( key ); } }
public boolean forEachEntry( TShortDoubleProcedure procedure ) { synchronized( mutex ) { return m.forEachEntry( procedure ); } } public void transformValues( TDoubleFunction function ) {
/** * Retrieves the value for <tt>key</tt> * * @param key an <code>Object</code> value * @return the value of <tt>key</tt> or null if no such mapping exists. */ @Override public Double get( Object key ) { if (! ( key instanceof Short ) ) { return null; } short k = unwrapKey( key ); double v = _map.get( k ); if (v == _map.getNoEntryValue() && !_map.containsKey( k ) ) { return null; } return wrapValue( v ); }
public boolean containsKey( short key ) { synchronized( mutex ) { return m.containsKey( key ); } } public boolean containsValue( double value ){
public short getNoEntryKey() { return m.getNoEntryKey(); } public double getNoEntryValue() { return m.getNoEntryValue(); }
/** * Checks for the present of <tt>key</tt> in the keys of the map. * * @param key an <code>Object</code> value * @return a <code>boolean</code> value */ public boolean containsKey( Object key ) { if ( key == null ) return _map.containsKey( _map.getNoEntryKey() ); return key instanceof Short && _map.containsKey( unwrapKey( key ) ); }
/** * Retrieves the value for <tt>key</tt> * * @param key an <code>Object</code> value * @return the value of <tt>key</tt> or null if no such mapping exists. */ public Double get( Object key ) { short k; if ( key != null ) { if ( key instanceof Short ) { k = unwrapKey( key ); } else { return null; } } else { k = _map.getNoEntryKey(); } double v = _map.get( k ); // There may be a false positive since primitive maps // cannot return null, so we have to do an extra // check here. if ( v == _map.getNoEntryValue() ) { return null; } else { return wrapValue( v ); } }
public boolean containsValue( double val ) { return m.containsValue( val ); } public double get( short key) { return m.get( key ); }
public boolean forEachKey( TShortProcedure procedure ) { synchronized( mutex ) { return m.forEachKey( procedure ); } } public boolean forEachValue( TDoubleProcedure procedure ) {