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

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

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

TObjectIntMap.get介绍

[英]Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

More formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null :, then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

If this map permits null values, then a return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The #containsKey operation may be used to distinguish these two cases.
[中]返回指定键映射到的值,如果此映射不包含该键的映射,则返回null。
更正式地说,如果这个映射包含从键k到值v的映射,使得(键==null?k==null:),那么这个方法返回v;否则它返回null(最多可以有一个这样的映射)
如果该映射允许null值,那么null的返回值不一定表示该映射不包含密钥的映射;映射也可能显式地将密钥映射为null。#containsKey操作可用于区分这两种情况。

代码示例

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

@Override
public final synchronized long getCounter(String task) {
  return taskCounters.get(task);
}

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

/**
 * 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 v = _map.get( key );
  // 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 );
  }
}

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

public int getTime(Vertex v) {
  return times.get(v);
}

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

int value = iter.value();
if ( value == no_entry_value ) {
  if ( !( that.get( key ) == that.getNoEntryValue() &&
    that.containsKey( key ) ) ) {
  if ( value != that.get( key ) ) {
    return false;

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

public int getPrev (TransitStop t) {
  return matrix[current - 1].get(t);
}

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

public int get( Object key ) {
  synchronized( mutex ) { return m.get( key ); }
}

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

public int getTime (TransitStop t) {
  return bestStops.get(t);
}

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

public int get( Object key )            { return m.get( key ); }

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

/** Returns true if it is OK to steal a worker _away_ from this graphId. */
boolean tooManyWorkers (String graphId) {
  return targetWorkerCountPerGraph.get(graphId) < workersByGraph.get(graphId).size();
}

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

/** Returns true if it is OK to steal a worker toward this graphId. */
boolean notEnoughWorkers (String graphId) {
  return targetWorkerCountPerGraph.get(graphId) > workersByGraph.get(graphId).size();
}

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

private int getTileIndex(ResourceUrn uri, boolean warnOnError) {
  if (tileIndexes.containsKey(uri)) {
    return tileIndexes.get(uri);
  }
  if (warnOnError) {
    logger.warn("Tile {} could not be resolved", uri);
  }
  return 0;
}

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

/**
 * Get the index of a particular feature ID in this pointset.
 * @return the index, or -1 if there is no such index.
 */
public int getIndexForFeature(String featureId) {
  
  // this is called inside a conditional because the build method is synchronized,
  // and there is no need to synchronize if the map has already been built.
  if (idIndexMap == null)
    buildIdIndexMapIfNeeded();
  
  return idIndexMap.get(featureId);
}

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

@Override
public String toString() {
  final StringBuilder b = new StringBuilder(100);
  b.append(name).append(isAlive() ? " [ALIVE]" : " [DEAD]").append(" Id = ").append(id);
  for (String task : tasks) {
    b.append(", ").append(task).append(" = ").append(taskCounters.get(task));
  }
  if (hasErrors()) {
    b.append(" [Errors = ").append(getNumErrors()).append(", ").append(getLastError().getClass().getSimpleName()).append("]");
  }
  return b.toString();
}

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

@Override
public boolean put(TransitStop t, int time, boolean transfer) {
  // This does not store internal algorithm state as it used to, but rather only the output.
  // The reasoning is that, in dynamic programming/range RAPTOR mode, bestStops is carried over between runs of
  // the algorithm. But you still want to propagate a non-optimal time with fewer transfers, because the
  // optimal time at this stop might have already used up all of the transfers.
  if (!transfer && time < bestStops.get(t))
    bestStops.put(t, time);
  if (time < matrix[current].get(t)) {
    matrix[current].put(t, time);
    return true;
  }
  return false;
}

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

@Override
public boolean put(ProfileState ps) {
  if (ps.lowerBound < minUpperBounds.get(ps.stop)) {
    states.put(ps.stop, ps);
    
    if (ps.upperBound < minUpperBounds.get(ps.stop)) {
      minUpperBounds.put(ps.stop, ps.upperBound);
      
      // kick out old states
      for (Iterator<ProfileState> it = states.get(ps.stop).iterator(); it.hasNext();) {
        // need to use strictly-greater-than here, so states with no variation don't dominate themselves.
        if (it.next().lowerBound > ps.upperBound) {
          it.remove();
        }
      }
    }
    
    return true;
  }
  else {
    return false;
  }
}

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

@Override
public boolean put(ProfileState ps) {
  if (ps.lowerBound >= minUpperBounds.get(ps.stop))
    return false;
  
  ps.previous = null;
  
  if (ps.upperBound < minUpperBounds.get(ps.stop))
    minUpperBounds.put(ps.stop, ps.upperBound);
  
  if (states.containsKey(ps.stop)) {
    // merge it in; it is not dominates
    ProfileState o = states.get(ps.stop);
    o.mergeIn(ps);
  }
  else {
    ps.patterns = null;
    states.put(ps.stop, ps);
  }
  
  return true;
}

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

private int getUniformLocation(int activeShaderProgramId, String desc) {
  UniformId id = new UniformId(activeShaderProgramId, desc);
  if (uniformLocationMap.containsKey(id)) {
    return uniformLocationMap.get(id);
  }
  int loc = GL20.glGetUniformLocation(activeShaderProgramId, desc);
  uniformLocationMap.put(id, loc);
  return loc;
}

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

Vertex vertex = state.getVertex();
if (vertex instanceof StreetVertex || vertex instanceof TransitStop) {
  int existing = times.get(vertex);
  int t = (int) state.getActiveTime();
  if (existing == UNREACHABLE || existing > t) {

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

@Override
public void proceed() {
  for (TObjectIntIterator<TransitStop> it = matrix[current].iterator(); it.hasNext();) {
    it.advance();
    if (it.value() < matrix[current + 1].get(it.key()))
      matrix[current + 1].put(it.key(), it.value());
  }
  current++;
}

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

@Override
public void setTexture(String desc, Texture texture) {
  if (isDisposed()) {
    return;
  }
  int texId;
  if (bindMap.containsKey(desc)) {
    texId = bindMap.get(desc);
  } else {
    // TODO: do this initially, and try and have similar textures in similar slots for all materials.
    ShaderParameterMetadata metadata = shader.getParameter(desc);
    if (metadata == null || !metadata.getType().isTexture()) {
      return;
    }
    texId = textureIndex++;
    // Make sure to bind the texture for all permutations
    setInt(desc, texId);
    bindMap.put(desc, texId);
  }
  textureMap.put(texId, texture);
}

相关文章