/** * Creates a new <code>TIntIntHashMap</code> instance containing * all of the entries in the map passed in. * * @param keys a <tt>int</tt> array containing the keys for the matching values. * @param values a <tt>int</tt> array containing the values. */ public TIntIntHashMap( int[] 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 Integer, ? extends Integer> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Integer, ? extends Integer> entry : map.entrySet() ) { this.put( entry.getKey().intValue(), entry.getValue().intValue() ); } }
public int lookupIndex(int code, int indent) { if (indent < 1) throw new IllegalArgumentException( "Invalid Argument in FeatureAlphabet: " + indent); int ret = intdata.get(code); if (ret==-1 && !frozen) {//字典中没有,并且允许插入 synchronized (this) { intdata.put(code, last); ret = last; last += indent; } } return ret; }
/** {@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) { int key = in.readInt(); int val = in.readInt(); put(key, val); } } } // TIntIntHashMap
TIntIntHashMap ours = new TIntIntHashMap(SET_SIZE); for ( int i = dataset.size(); i-- > 0; ) { ours.put(i, i);
assert(index.get(ngramidx) == n1gramidx); else index.put(ngramidx, n1gramidx);
/** {@inheritDoc} */ public void putAll( TIntIntMap map ) { ensureCapacity( map.size() ); TIntIntIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
public ItemStack addMeta(int meta, String name, int amount) { values.put(meta, amount); ItemStack ret = addMeta(meta, name); return ret; }
int value = it.key(); int key = it.value(); index.put(key, value);
splitParents.put(splitCount, next.splitNo);
/** {@inheritDoc} */ public void putAll( Map<? extends Integer, ? extends Integer> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Integer, ? extends Integer> entry : map.entrySet() ) { this.put( entry.getKey().intValue(), entry.getValue().intValue() ); } }
private final TIntIntHashMap map = ... public void putInt(int x, int y, int value) { int index = (x << 16) + y; map.put(index, value); // only uses primitives. } public int getInt(int x, int y) { int index = (x << 16) + y; return map.get(index); }
@Override public boolean execute(int hash, int id) { if (featureCounts.get(id) > threshold) lex.feature2Id.put(hash, id); return true; } });
private void initProfile() { for (int d = 0; d < nbDims; d++) { //What is necessarily used on the resource profilesMin[d].clear(); //Maximum possible usage on the resource profilesMax[d].clear(); profilesMax[d].put(0, capacities[d] - startupFree[d]); profilesMin[d].put(0, capacities[d] - startupFree[d]); } }
@Override public SparseIntArray reverse() { //TODO: this could be more efficient and avoid the copy TIntIntHashMap tmp = new TIntIntHashMap(data.size()); for (Entry e : entries()) tmp.put(length - e.index, e.value); this.data = tmp; return this; } }
/** {@inheritDoc} */ public void putAll( TIntIntMap map ) { ensureCapacity( map.size() ); TIntIntIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }