public int put( int key, int value ) { synchronized( mutex ) { return m.put( key, value ); } } public int remove( int key ) {
/** * Compiles all combination of available features and stores them in two maps for * lookup based on a unique hash of features. */ private void registerAllShaderPermutations() { Set<Set<ShaderProgramFeature>> allPermutations = Sets.powerSet(availableFeatures); for (Set<ShaderProgramFeature> permutation : allPermutations) { int fragShaderId = compileShader(GL20.GL_FRAGMENT_SHADER, permutation); int vertShaderId = compileShader(GL20.GL_VERTEX_SHADER, permutation); if (compileSuccess(fragShaderId) && compileSuccess(vertShaderId)) { int featureHash = ShaderProgramFeature.getBitset(permutation); disposalAction.fragmentPrograms.put(featureHash, fragShaderId); disposalAction.vertexPrograms.put(featureHash, vertShaderId); } else { throw new RuntimeException(String.format("Shader '%s' failed to compile for features '%s'.%n%n" + "Vertex Shader Info: %n%s%n" + "Fragment Shader Info: %n%s", getUrn(), permutation, getLogInfo(vertShaderId), getLogInfo(fragShaderId))); } } logger.debug("Compiled {} permutations for {}.", allPermutations.size(), getUrn()); }
@Override public Op create(MethodLocation location, TIntObjectMap<MethodLocation> addressToLocation, VirtualMachine vm) { SwitchPayload instr = (SwitchPayload) location.getInstruction(); TIntIntMap targetKeyToOffset = new TIntIntHashMap(); for (SwitchElement element : instr.getSwitchElements()) { targetKeyToOffset.put(element.getKey(), element.getOffset()); } return new SwitchPayloadOp(location, addressToLocation, targetKeyToOffset); }
int stopIndex = initialIterator.key(); int accessTime = initialIterator.value(); initialStops.put(stopIndex, accessTime);
@Override public void recompile() { TIntIntIterator it = disposalAction.shaderPrograms.iterator(); while (it.hasNext()) { it.advance(); GL20.glDeleteProgram(it.value()); } disposalAction.shaderPrograms.clear(); uniformLocationMap.clear(); bindMap.clear(); disposalAction.shaderPrograms.put(0, shader.linkShaderProgram(0)); for (Set<ShaderProgramFeature> permutation : Sets.powerSet(shader.getAvailableFeatures())) { int featureMask = ShaderProgramFeature.getBitset(permutation); disposalAction.shaderPrograms.put(featureMask, shader.linkShaderProgram(featureMask)); } //resolves #966 //Some of the uniforms are not updated constantly between frames //this function will rebind any uniforms that are not bound rebindVariables(materialData); }
/** * 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 Integer(0) if none was found. */ public Integer put( Integer key, Integer value ) { int k; int v; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } if ( value == null ) { v = _map.getNoEntryValue(); } else { v = unwrapValue( value ); } int retval = _map.put( k, v ); if ( retval == _map.getNoEntryValue() ) { return null; } return wrapValue( retval ); }
private void checkMaxVisits(ExecutionNode node, VirtualMethod localMethod, TIntIntMap addressToVisitCount) throws MaxAddressVisitsExceededException, MaxMethodVisitsExceededException { if (totalVisits > getMaxMethodVisits()) { throw new MaxMethodVisitsExceededException(node, localMethod.getSignature()); } int address = node.getAddress(); int visitCount = addressToVisitCount.get(address); if (visitCount > getMaxAddressVisits()) { throw new MaxAddressVisitsExceededException(node, localMethod.getSignature()); } boolean adjusted = addressToVisitCount.adjustValue(address, 1); if (!adjusted) { addressToVisitCount.put(address, 1); } }
if (stopIndex == -1) { stopIndex = indexForStop.size(); indexForStop.put(vidx, stopIndex); stopForIndex.add(vidx); stopNames.add(stop.getName()); indexForStop.put(t.index, stopIndex); stopForIndex.add(t.index); transfersFromStopWithGraphIndices.put(stopForIndex.get(trIt.key()), trIt.value()); temporaryTransfers.get(graphIndex).put(t.index, it.value()); out.put(s.index, time);
private synchronized void decrementReadCount(int clientIndex) { if (readLockHolders == null) { throw LockServerLock.throwIllegalMonitorStateException( clients.fromIndex(clientIndex) + " does not hold the read lock"); } int readCount = readLockHolders.remove(clientIndex); if (readCount > 1) { readLockHolders.put(clientIndex, readCount - 1); } else if (readCount == 0) { throw LockServerLock.throwIllegalMonitorStateException( clients.fromIndex(clientIndex) + " does not hold the read lock"); } }
@Override public int put( int key, int value ) { synchronized( mutex ) { return m.put( key, value ); } } @Override
public int put( int key, int value ) { synchronized( mutex ) { return m.put( key, value ); } } public int remove( int key ) {
@Override @Deprecated public Integer put(DBIDRef id, Integer value) { return Integer.valueOf(map.put(DBIDUtil.asInteger(id), value.intValue())); }
/** * {@inheritDoc} */ public int add(int index, int delta) { int val = map.get(index); int newVal = val + delta; map.put(index, newVal); return newVal; }
return ItemStack.EMPTY; assigned.put(i, candidate);
@Override public void setup(final int[] keys, final float fillFactor, int oneFailOutOf) { super.setup( keys, fillFactor, oneFailOutOf ); m_map = new TIntIntHashMap( keys.length, fillFactor ); for (int key : keys) m_map.put( key + (key % oneFailOutOf == 0 ? 1 : 0), key ); }
/** * {@inheritDoc} */ public void set(int index, int value) { int cur = map.get(index); if (value == 0) { if (cur != 0) map.remove(index); } else map.put(index, value); }
public RandomIntSet(int... items) { this(items.length); for (int item : items) { idx.put(item, dta.size()); dta.add(item); } }
@Override public void accept(int item) { idx.put(item, dta.size()); dta.add(item); } });
public boolean add(int item) { if (idx.containsKey(item)) { return false; } idx.put(item, dta.size()); dta.add(item); return true; }