@Override public final synchronized long getCounter(String task) { return taskCounters.get(task); }
/** * 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 ); } }
public int getTime(Vertex v) { return times.get(v); }
public int getPrev (TransitStop t) { return matrix[current - 1].get(t); }
public int get( Object key ) { synchronized( mutex ) { return m.get( key ); } }
public int getTime (TransitStop t) { return bestStops.get(t); }
public int get( Object key ) { return m.get( key ); }
/** 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(); }
/** 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(); }
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; }
/** * 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); }
@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(); }
@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; }
@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; } }
@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; }
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; }
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) {
@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++; }
@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); }