Refine search
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntIntMap ) ) { return false; } TIntIntMap that = ( TIntIntMap ) other; if ( that.size() != this.size() ) { return false; } int[] values = _values; byte[] states = _states; int this_no_entry_value = getNoEntryValue(); int that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; int that_value = that.get( key ); int 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; }
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); } }
/** * 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 ) ); }
@Override public String toString() { StringBuilder sb = new StringBuilder(getName()); sb.append(" ["); int[] keys = targetKeyToOffset.keys(); Arrays.sort(keys); for (int key : keys) { int offset = targetKeyToOffset.get(key); sb.append(key).append(" -> :addr_").append(offset).append(", "); } sb.setLength(sb.length() - 2); sb.append(']'); return sb.toString(); }
for (Stop stop : pattern.getStops()) { int vidx = graph.index.stopVertexForStop.get(stop).getIndex(); int stopIndex = indexForStop.get(vidx); 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); .mapToInt(t -> indexForStop.get(t.index)) .toArray(); for (TIntIntIterator trIt = transfersFromStop.iterator(); trIt.hasNext();) { trIt.advance(); transfersFromStopWithGraphIndices.put(stopForIndex.get(trIt.key()), trIt.value()); for (TIntIntIterator it = transfersToStop.iterator(); it.hasNext(); ) { it.advance(); temporaryTransfers.get(graphIndex).put(t.index, it.value()); int targetStopIndex = indexForStop.get(simpleTransfer.getToVertex().getIndex()); if (targetStopIndex != -1) { transfers.add(targetStopIndex); for (TIntIntIterator tranIt = temporaryTransfers.get(stop).iterator(); tranIt.hasNext();) {
@Override public SRResultList mostSimilar(int pageId, int maxResults, TIntSet validIds) throws DaoException { TIntIntMap scores = new TIntIntHashMap(); for (int id : getLinks(pageId, true)) { if (validIds == null || validIds.contains(id)) scores.adjustOrPutValue(id, 1, 1); } for (int id : getLinks(pageId, false)) { if (validIds == null || validIds.contains(id)) scores.adjustOrPutValue(id, 1, 1); } Leaderboard leaderboard = new Leaderboard(maxResults); for (int id : scores.keys()) { leaderboard.tallyScore(id, scores.get(id) / 2.0); } return normalize(leaderboard.getTop()); }
/** {@inheritDoc} */ public void putAll( TIntIntMap map ) { ensureCapacity( map.size() ); TIntIntIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
@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); }
TIntIntMap accessTimes = new TIntIntHashMap(); int stopIndex = indexForStop.get(tstop.getIndex()); accessTimes.put(stopIndex, (int) s.getElapsedTimeSeconds()); else accessTimes.put(stopIndex, (int) (s.getWalkDistance() / walkSpeed)); accessTimes.put(it.value(), (int) (dist / walkSpeed));
TIntIntMap initialStops = new TIntIntHashMap(); TIntIntIterator initialIterator = accessTimes.iterator(); while (initialIterator.hasNext()) { initialIterator.advance(); int stopIndex = initialIterator.key(); int accessTime = initialIterator.value(); initialStops.put(stopIndex, accessTime);
TIntIntMap assigned = new TIntIntHashMap(); TinkersItem tool = (TinkersItem) toolStack.getItem(); if(!assigned.valueCollection().contains(j)) { candidate = j; return ItemStack.EMPTY; assigned.put(i, candidate); if(assigned.isEmpty()) { return ItemStack.EMPTY; assigned.forEachEntry((i, j) -> { String mat = ((IToolPart) toolParts.get(i).getItem()).getMaterial(toolParts.get(i)).getIdentifier(); materialList.set(j, new NBTTagString(mat));
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 void execute(ExecutionNode node, MethodState mState) { // Pseudo points to instruction *after* switch op. MethodLocation returnLocation = mState.getPseudoInstructionReturnInstruction(); int branchFromAddress = returnLocation.getCodeAddress() - SWITCH_OP_CODE_UNITS; HeapItem targetItem = mState.readResultRegister(); if (targetItem.isUnknown()) { List<MethodLocation> childList = getTargets(branchFromAddress, targetKeyToOffset); childList.add(returnLocation); MethodLocation[] children = childList.toArray(new MethodLocation[childList.size()]); node.setChildLocations(children); return; } int targetKey = Utils.getIntegerValue(targetItem.getValue()); if (targetKeyToOffset.containsKey(targetKey)) { int targetOffset = branchFromAddress + targetKeyToOffset.get(targetKey); MethodLocation child = addressToLocation.get(targetOffset); node.setChildLocations(child); return; } // Branch target is unspecified. Continue to next op. node.setChildLocations(returnLocation); }
protected static int getGroupColor(int group) { if (!CACHED_GROUP_COLORS.containsKey(group)) { Random rand = new Random(group); int color = rand.nextInt(1 << 23) | (255 << 24); CACHED_GROUP_COLORS.put(group, color); return color; } return CACHED_GROUP_COLORS.get(group); }
private int getActiveShaderProgramId() { return disposalAction.shaderPrograms.get(activeFeaturesMask); }
private synchronized void incrementReadCount(int clientIndex) { if (readLockHolders == null) { readLockHolders = new TIntIntHashMap(1); } readLockHolders.adjustOrPutValue(clientIndex, 1, 1); }
@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); }
/** * 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 Integer get( Object key ) { int k; if ( key != null ) { if ( key instanceof Integer ) { k = unwrapKey( key ); } else { return null; } } else { k = _map.getNoEntryKey(); } int 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 int[] keys() { synchronized( mutex ) { return m.keys(); } } public int[] keys( int[] array ) {