/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntFloatMap ) ) { return false; } TIntFloatMap that = ( TIntFloatMap ) other; if ( that.size() != this.size() ) { return false; } float[] values = _values; byte[] states = _states; float this_no_entry_value = getNoEntryValue(); float that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; float that_value = that.get( key ); float 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; }
/** * 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 Integer && _map.containsKey( unwrapKey( key ) ); }
public int[] keys() { synchronized( mutex ) { return m.keys(); } } public int[] keys( int[] array ) {
/** * 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 Float get( Object key ) { int k; if ( key != null ) { if ( key instanceof Integer ) { k = unwrapKey( key ); } else { return null; } } else { k = _map.getNoEntryKey(); } float 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 float get( int key ) { synchronized( mutex ) { return m.get( key ); } }
TIntFloatMap candidateVector = generator.getVector(ids[i]); if (candidateVector != null) { for (int id : candidateVector.keys()) { double w = Math.sqrt(merged.get(ids[i]) / total); double v = candidateVector.get(id); vector.adjustOrPutValue(id, (float)(w * v), (float)(w * v)); if (vector.isEmpty()) { return null; } else {
public float put( int key, float value ) { synchronized( mutex ) { return m.put( key, value ); } } public float remove( int key ) {
/** * 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 Float(0) if none was found. */ public Float put( Integer key, Float value ) { int k; float v; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } if ( value == null ) { v = _map.getNoEntryValue(); } else { v = unwrapValue( value ); } float retval = _map.put( k, v ); if ( retval == _map.getNoEntryValue() ) { return null; } return wrapValue( retval ); }
public float[] values() { synchronized( mutex ) { return m.values(); } } public float[] values( float[] array ) {
public boolean containsKey( int key ) { synchronized( mutex ) { return m.containsKey( key ); } } public boolean containsValue( float value ){
public boolean forEachEntry( TIntFloatProcedure procedure ) { synchronized( mutex ) { return m.forEachEntry( procedure ); } } public void transformValues( TFloatFunction function ) {
public boolean isEmpty(){ synchronized( mutex ) { return m.isEmpty(); } } public boolean containsKey( int key ) {
/** * Returns the number of entries in the map. * * @return the map's size. */ public int size() { return this._map.size(); }
public TIntFloatIterator iterator() { return m.iterator(); // Must be manually synched by user! }
public float adjustOrPutValue( int key, float adjust_amount, float put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
public float get( int key) { return m.get( key ); }
public float put( int key, float value ) { synchronized( mutex ) { return m.put( key, value ); } } public float remove( int key ) {