/** * Creates a new <code>TLongIntHashMap</code> instance containing * all of the entries in the map passed in. * * @param keys a <tt>long</tt> array containing the keys for the matching values. * @param values a <tt>int</tt> array containing the values. */ public TLongIntHashMap( long[] keys, int[] values ) { super( Math.max( keys.length, values.length ) ); int size = Math.min( keys.length, values.length ); for ( int i = 0; i < size; i++ ) { this.put( keys[i], values[i] ); } }
/** {@inheritDoc} */ public void putAll( Map<? extends Long, ? extends Integer> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Long, ? extends Integer> entry : map.entrySet() ) { this.put( entry.getKey().longValue(), entry.getValue().intValue() ); } }
/** {@inheritDoc} */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION in.readByte(); // SUPER super.readExternal( in ); // NUMBER OF ENTRIES int size = in.readInt(); setUp( size ); // ENTRIES while (size-- > 0) { long key = in.readLong(); int val = in.readInt(); put(key, val); } } } // TLongIntHashMap
/** {@inheritDoc} */ public void putAll( TLongIntMap map ) { ensureCapacity( map.size() ); TLongIntIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
/** * Creates a new <code>TLongIntHashMap</code> instance containing * all of the entries in the map passed in. * * @param keys a <tt>long</tt> array containing the keys for the matching values. * @param values a <tt>int</tt> array containing the values. */ public TLongIntHashMap( long[] keys, int[] values ) { super( Math.max( keys.length, values.length ) ); int size = Math.min( keys.length, values.length ); for ( int i = 0; i < size; i++ ) { this.put( keys[i], values[i] ); } }
/** * Creates a new <code>TLongIntHashMap</code> instance containing * all of the entries in the map passed in. * * @param keys a <tt>long</tt> array containing the keys for the matching values. * @param values a <tt>int</tt> array containing the values. */ public TLongIntHashMap( long[] keys, int[] values ) { super( Math.max( keys.length, values.length ) ); int size = Math.min( keys.length, values.length ); for ( int i = 0; i < size; i++ ) { this.put( keys[i], values[i] ); } }
/** * Creates a new <code>TLongIntHashMap</code> instance containing * all of the entries in the map passed in. * * @param keys a <tt>long</tt> array containing the keys for the matching values. * @param values a <tt>int</tt> array containing the values. */ public TLongIntHashMap( long[] keys, int[] values ) { super( Math.max( keys.length, values.length ) ); int size = Math.min( keys.length, values.length ); for ( int i = 0; i < size; i++ ) { this.put( keys[i], values[i] ); } }
/** {@inheritDoc} */ @Override public void putAll( Map<? extends Long, ? extends Integer> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Long, ? extends Integer> entry : map.entrySet() ) { this.put( entry.getKey().longValue(), entry.getValue().intValue() ); } }
/** {@inheritDoc} */ public void putAll( Map<? extends Long, ? extends Integer> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Long, ? extends Integer> entry : map.entrySet() ) { this.put( entry.getKey().longValue(), entry.getValue().intValue() ); } }
/** {@inheritDoc} */ public void putAll( Map<? extends Long, ? extends Integer> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Long, ? extends Integer> entry : map.entrySet() ) { this.put( entry.getKey().longValue(), entry.getValue().intValue() ); } }
/** Return -1 if entry isn't present. */ public int lookupIndex (long entry) { int ret = map.get(entry); if (ret <= 0 && !growthStopped) { numEntries++; ret = numEntries; map.put (entry, ret); } return ret - 1; // feature id should be 0-based }
/** Return -1 if entry isn't present. */ public int lookupIndex (long entry, int value) { int ret = map.get(entry); if (ret <= 0 && !growthStopped) { numEntries++; ret = value + 1; map.put (entry, ret); } return ret - 1; // feature id should be 0-based }
/** Return -1 if entry isn't present. */ public int lookupIndex (long entry) { int ret = map.get(entry); if (ret <= 0 && !growthStopped) { numEntries++; ret = numEntries; map.put (entry, ret); } return ret - 1; // feature id should be 0-based }
/** {@inheritDoc} */ public void putAll( Map<? extends Long, ? extends Integer> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Long, ? extends Integer> entry : map.entrySet() ) { this.put( entry.getKey().longValue(), entry.getValue().intValue() ); } }
/** Return -1 if entry isn't present. */ public int lookupIndex (long entry, int value) { int ret = map.get(entry); if (ret <= 0 && !growthStopped) { numEntries++; ret = value + 1; map.put (entry, ret); } return ret - 1; // feature id should be 0-based }
/** * Count an instance of this Nmer * @param nmer */ public void count(Nmer nmer) { long key = nmer.getNmer(); int count = hash.get(key) + 1; hash.put(key, count); }
/** {@inheritDoc} */ public void putAll( TLongIntMap map ) { ensureCapacity( map.size() ); TLongIntIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
/** {@inheritDoc} */ @Override public void putAll( TLongIntMap map ) { ensureCapacity( map.size() ); TLongIntIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
/** {@inheritDoc} */ public void putAll( TLongIntMap map ) { ensureCapacity( map.size() ); TLongIntIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
/** {@inheritDoc} */ public void putAll( TLongIntMap map ) { ensureCapacity( map.size() ); TLongIntIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }