private void removeObject(T object, long tile) { if(objects.containsKey(tile)){ objects.get(tile).remove(object); } }
private long addObject(T object, long tile) { if(!objects.containsKey(tile)){ objects.put(tile, new ArrayList<T>()); } objects.get(tile).add(object); return tile; }
private void putObjects(int tx, int ty, List<T> r){ if(objects.containsKey(evTile(tx, ty))){ r.addAll(objects.get(evTile(tx, ty))); } }
RouteSegmentPoint next = pntIterator.next(); boolean visitedAlready = false; if (next.getSegmentStart() > 0 && visited.containsKey(calculateRoutePointId(next, false))) { visitedAlready = true; } else if (next.getSegmentStart() < next.getRoad().getPointsLength() - 1 && visited.containsKey(calculateRoutePointId(next, true))) { visitedAlready = true;
private void getAllObjects(long tileId, final List<RouteDataObject> toFillIn, TLongObjectHashMap<RouteDataObject> excludeDuplications) { if (tileRoutes.containsKey(tileId)) { List<RouteDataObject> routes = tileRoutes.get(tileId); if (routes != null) { for (RouteDataObject ro : routes) { if (!excludeDuplications.contains(ro.id)) { excludeDuplications.put(ro.id, ro); toFillIn.add(ro); } } } } List<RoutingSubregionTile> subregions = indexedSubregions.get(tileId); if (subregions != null) { for (RoutingSubregionTile rs : subregions) { rs.loadAllObjects(toFillIn, this, excludeDuplications); } } }
for (int y = (int) topLeftY; y <= bottomRightY; y++) { long hash = (((long) x) << SearchRequest.ZOOM_TO_SEARCH_POI) + y; if (!zooms.containsKey(hash)) { zooms.put(hash, new LinkedList<Location>());
if (!indexedSubregions.containsKey(tileId)) { List<RoutingSubregionTile> collection = loadTileHeaders(x31, y31); indexedSubregions.put(tileId, collection);
" segmentPoint=" + segmentPoint + " -- ", next, true); if (!visitedSegments.containsKey(calculateRoutePointId(next, next.isPositive()))) { if (next.getParentRoute() == null || ctx.roadPriorityComparator(next.distanceFromStart, next.distanceToEnd,
private boolean checkIfOppositeSegmentWasVisited(final RoutingContext ctx, boolean reverseWaySearch, PriorityQueue<RouteSegment> graphSegments, RouteSegment segment, TLongObjectHashMap<RouteSegment> oppositeSegments, int segmentPoint, float segmentDist, float obstaclesTime) { RouteDataObject road = segment.getRoad(); long opp = calculateRoutePointId(road, segment.isPositive() ? segmentPoint - 1 : segmentPoint, !segment.isPositive()); if (oppositeSegments.containsKey(opp)) { RouteSegment opposite = oppositeSegments.get(opp); RouteSegment to = reverseWaySearch ? getParentDiffId(segment) : getParentDiffId(opposite); RouteSegment from = !reverseWaySearch ? getParentDiffId(segment) : getParentDiffId(opposite); if (checkViaRestrictions(from, to)) { FinalRouteSegment frs = new FinalRouteSegment(road, segmentPoint); float distStartObstacles = segment.distanceFromStart + calculateTimeWithObstacles(ctx, road, segmentDist, obstaclesTime); frs.setParentRoute(segment); frs.setParentSegmentEnd(segmentPoint); frs.reverseWaySearch = reverseWaySearch; frs.distanceFromStart = opposite.distanceFromStart + distStartObstacles; frs.distanceToEnd = 0; frs.opposite = opposite; graphSegments.add(frs); if (TRACE_ROUTING) { printRoad(" >> Final segment : ", frs, reverseWaySearch); } return true; } } return false; }
TLongObjectHashMap<RouteDataObject> excludeDuplications = new TLongObjectHashMap<RouteDataObject>(); RouteSegment original = null; if (tileRoutes.containsKey(tileId)) { List<RouteDataObject> routes = tileRoutes.get(tileId); if (routes != null) {
protected Collection<PermOverrideData> getOverrides() { //note: overridesAdd and overridesRem are mutually disjoint TLongObjectHashMap<PermOverrideData> data = new TLongObjectHashMap<>(this.overridesAdd); AbstractChannelImpl<?> impl = (AbstractChannelImpl<?>) getChannel(); impl.getOverrideMap().forEachEntry((id, override) -> { //removed by not adding them here, this data set overrides the existing one //we can use remove because it will be reset afterwards either way if (!overridesRem.remove(id) && !data.containsKey(id)) data.put(id, new PermOverrideData(override)); return true; }); return data.valueCollection(); }
@Override public boolean hasDataForJoint(OneDoFJoint joint) { return lowLevelJointDataMap.containsKey(joint.nameBasedHashCode()); }
public void registerLowLevelJointData(OneDoFJoint joint, LowLevelJointDataReadOnly jointDataToRegister) { if (lowLevelJointDataMap.containsKey(joint.nameBasedHashCode())) throwJointAlreadyRegisteredException(joint); registerLowLevelJointDataUnsafe(joint, jointDataToRegister); }
public void registerJointWithEmptyData(OneDoFJoint joint) { if (lowLevelJointDataMap.containsKey(joint.nameBasedHashCode())) throwJointAlreadyRegisteredException(joint); registerJointWithEmptyDataUnsafe(joint); }
public boolean add(float x, float y, float z) { long hash = hash(x, y, z, resolution); removeDecayedPoints(); if (!map.containsKey(hash)) { TimestampedPoint point = new TimestampedPoint(x, y, z, System.currentTimeMillis()); synchronized (list) { atomicAddToMapAndList(hash, point); } return true; } return false; }
public boolean add(float x, float y, float z) { long hash = hash(x, y, z, resolution); removeDecayedPoints(); if (!map.containsKey(hash)) { TimestampedPoint point = new TimestampedPoint(x, y, z, System.currentTimeMillis()); synchronized (list) { atomicAddToMapAndList(hash, point); } return true; } return false; }
if (!decomposerMap.containsKey(buf[0])) { decomposerMap.forEachKey(new TLongProcedure() { @Override