gnu.trove.map.TIntIntMap.put()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中gnu.trove.map.TIntIntMap.put()方法的一些代码示例,展示了TIntIntMap.put()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TIntIntMap.put()方法的具体详情如下:
包路径:gnu.trove.map.TIntIntMap
类名称:TIntIntMap
方法名:put

TIntIntMap.put介绍

[英]Inserts a key/value pair into the map.
[中]将键/值对插入到映射中。

代码示例

代码示例来源:origin: alibaba/mdrill

public int put( int key, int value ) {
  synchronized( mutex ) { return m.put( key, value ); }
}
public int remove( int key ) {

代码示例来源:origin: MovingBlocks/Terasology

/**
 * 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());
}

代码示例来源:origin: CalebFenton/simplify

@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);
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

accessTimes.put(stopIndex, (int) s.getElapsedTimeSeconds());
    else
      accessTimes.put(stopIndex, (int) (s.getWalkDistance() / walkSpeed));
accessTimes.put(it.value(), (int) (dist / walkSpeed));

代码示例来源:origin: opentripplanner/OpenTripPlanner

int stopIndex = initialIterator.key();
int accessTime = initialIterator.value();
initialStops.put(stopIndex, accessTime);

代码示例来源:origin: MovingBlocks/Terasology

@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);
}

代码示例来源:origin: alibaba/mdrill

/**
 * 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 );
}

代码示例来源:origin: CalebFenton/simplify

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);
  }
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

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);

代码示例来源:origin: palantir/atlasdb

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");
  }
}

代码示例来源:origin: com.palantir.patches.sourceforge/trove3

@Override
public int put( int key, int value ) {
  synchronized( mutex ) { return m.put( key, value ); }
}
@Override

代码示例来源:origin: net.sf.trove4j/trove4j

public int put( int key, int value ) {
  synchronized( mutex ) { return m.put( key, value ); }
}
public int remove( int key ) {

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

@Override
@Deprecated
public Integer put(DBIDRef id, Integer value) {
 return Integer.valueOf(map.put(DBIDUtil.asInteger(id), value.intValue()));
}

代码示例来源:origin: edu.ucla.sspace/sspace-wordsi

/**
 * {@inheritDoc}
 */
public int add(int index, int delta) {
  int val = map.get(index);
  int newVal = val + delta;
  map.put(index, newVal);
  return newVal;
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

return ItemStack.EMPTY;
assigned.put(i, candidate);

代码示例来源:origin: mikvor/hashmapTest

@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 );
}

代码示例来源:origin: edu.ucla.sspace/sspace-wordsi

/**
 * {@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);
}

代码示例来源:origin: de.unijena.bioinf.phylo/mincut

public RandomIntSet(int... items) {
  this(items.length);
  for (int item : items) {
    idx.put(item, dta.size());
    dta.add(item);
  }
}

代码示例来源:origin: de.unijena.bioinf.phylo/mincut

@Override
  public void accept(int item) {
    idx.put(item, dta.size());
    dta.add(item);
  }
});

代码示例来源:origin: de.unijena.bioinf.phylo/mincut

public boolean add(int item) {
  if (idx.containsKey(item)) {
    return false;
  }
  idx.put(item, dta.size());
  dta.add(item);
  return true;
}

相关文章