public SparseMatrixT(){ vector = new TLongObjectHashMap<T>(100,0.8f); }
public SparseMatrix(){ vector = new TLongObjectHashMap<T>(100,0.8f); }
public HashGridSpatialIndex(double xBinSize, double yBinSize) { if (xBinSize <= 0 || yBinSize <= 0) throw new IllegalStateException("bin size must be positive."); this.xBinSize = xBinSize; this.yBinSize = yBinSize; // For 200m bins, 500x500 = 100x100km = 250000 bins bins = new TLongObjectHashMap<>(); }
public Component put(long entityId, Component component) { TLongObjectMap<Component> entityMap = store.get(component.getClass()); if (entityMap == null) { entityMap = new TLongObjectHashMap<>(); store.put(component.getClass(), entityMap); } return entityMap.put(entityId, component); }
public SparseMatrixT<T> clone(){ SparseMatrixT<T> mat = new SparseMatrixT<T>(); mat.dim = this.dim; mat.vector = new TLongObjectHashMap<T>(vector); return mat; }
public void setLoadedNonNative(){ isLoaded = Math.abs(isLoaded) + 1; routes = new TLongObjectHashMap<BinaryRoutePlanner.RouteSegment>(); tileStatistics = new TileStatistics(); }
public List<RouteDataObject> loadRouteRegionData(RouteSubregion rs) throws IOException { TLongArrayList idMap = new TLongArrayList(); TLongObjectHashMap<RestrictionInfo> restrictionMap = new TLongObjectHashMap<RestrictionInfo>(); if (rs.dataObjects == null) { codedIS.seek(rs.filePointer + rs.shiftToData); int limit = codedIS.readRawVarint32(); int oldLimit = codedIS.pushLimit(limit); readRouteTreeData(rs, idMap, restrictionMap); codedIS.popLimit(oldLimit); } List<RouteDataObject> res = rs.dataObjects; rs.dataObjects = null; return res; }
public TransportRoutingContext(TransportRoutingConfiguration cfg, BinaryMapIndexReader... readers) { this.cfg = cfg; walkRadiusIn31 = (int) (cfg.walkRadius / MapUtils.getTileDistanceWidth(31)); walkChangeRadiusIn31 = (int) (cfg.walkChangeRadius / MapUtils.getTileDistanceWidth(31)); quadTree = new TLongObjectHashMap<List<TransportRouteSegment>>(); for (BinaryMapIndexReader r : readers) { routeMap.put(r, new TIntObjectHashMap<TransportRoute>()); } }
public void setLoadedNative(NativeRouteSearchResult r, RoutingContext ctx) { isLoaded = Math.abs(isLoaded) + 1; tileStatistics = new TileStatistics(); if (r.objects != null) { searchResult = null; routes = new TLongObjectHashMap<BinaryRoutePlanner.RouteSegment>(); for (RouteDataObject ro : r.objects) { if (ro != null && ctx.config.router.acceptLine(ro)) { add(ro); } } } else { searchResult = r; tileStatistics.size += 100; } } }
public void loadRouteRegionData(List<RouteSubregion> toLoad, ResultMatcher<RouteDataObject> matcher) throws IOException { Collections.sort(toLoad, new Comparator<RouteSubregion>() { @Override public int compare(RouteSubregion o1, RouteSubregion o2) { int p1 = o1.filePointer + o1.shiftToData; int p2 = o2.filePointer + o2.shiftToData; return p1 == p2 ? 0 : (p1 < p2 ? -1 : 1); } }); TLongArrayList idMap = new TLongArrayList(); TLongObjectHashMap<RestrictionInfo> restrictionMap = new TLongObjectHashMap<RestrictionInfo>(); for (RouteSubregion rs : toLoad) { if (rs.dataObjects == null) { codedIS.seek(rs.filePointer + rs.shiftToData); int limit = codedIS.readRawVarint32(); int oldLimit = codedIS.pushLimit(limit); readRouteTreeData(rs, idMap, restrictionMap); codedIS.popLimit(oldLimit); } for (RouteDataObject ro : rs.dataObjects) { if (ro != null) { matcher.publish(ro); } } // free objects rs.dataObjects = null; } }
SearchRequest<Amenity> request = new SearchRequest<Amenity>(); float coeff = (float) (radius / MapUtils.getTileDistanceWidth(SearchRequest.ZOOM_TO_SEARCH_POI)); TLongObjectHashMap<List<Location>> zooms = new TLongObjectHashMap<List<Location>>(); for (int i = 1; i < route.size(); i++) { Location cr = route.get(i);
public void loadTileData(int x31, int y31, int zoomAround, final List<RouteDataObject> toFillIn) { int t = config.ZOOM_TO_LOAD_TILES - zoomAround; int coordinatesShift = (1 << (31 - config.ZOOM_TO_LOAD_TILES)); if(t <= 0) { t = 1; coordinatesShift = (1 << (31 - zoomAround)); } else { t = 1 << t; } TLongHashSet ts = new TLongHashSet(); long now = System.nanoTime(); for(int i = -t; i <= t; i++) { for(int j = -t; j <= t; j++) { ts.add(getRoutingTile(x31 +i*coordinatesShift, y31 + j*coordinatesShift, 0, OPTION_IN_MEMORY_LOAD)); } } TLongIterator it = ts.iterator(); TLongObjectHashMap<RouteDataObject> excludeDuplications = new TLongObjectHashMap<RouteDataObject>(); while(it.hasNext()){ getAllObjects(it.next(), toFillIn, excludeDuplications); } timeToFindInitialSegments += (System.nanoTime() - now); }
TLongObjectHashMap<RouteSegment> visitedDirectSegments = new TLongObjectHashMap<RouteSegment>(); TLongObjectHashMap<RouteSegment> visitedOppositeSegments = new TLongObjectHashMap<RouteSegment>();
/** * Constructs an unavailable Widget */ private Widget(long guildId) { isAvailable = false; id = guildId; name = null; invite = null; channels = new TLongObjectHashMap<>(); members = new TLongObjectHashMap<>(); }
List<TransportRouteSegment> endStops = ctx.getTransportStops(end); TLongObjectHashMap<TransportRouteSegment> endSegments = new TLongObjectHashMap<TransportRouteSegment>(); for(TransportRouteSegment s : endStops) { endSegments.put(s.getId(), s);
TIntArrayList allPointsLoad = new TIntArrayList(); TLongObjectHashMap<TransportStop> loadedTransportStops = new TLongObjectHashMap<TransportStop>(); for(BinaryMapIndexReader r : routeMap.keySet()) { sr.clearSearchResults();
public RouteSegment loadRouteSegment(int x31, int y31, int memoryLimit) { long tileId = getRoutingTile(x31, y31, memoryLimit, OPTION_SMART_LOAD); TLongObjectHashMap<RouteDataObject> excludeDuplications = new TLongObjectHashMap<RouteDataObject>(); RouteSegment original = null; if (tileRoutes.containsKey(tileId)) {
/** * Generates a new thread-safe {@link gnu.trove.map.TLongObjectMap TLongObjectMap} * * @param <T> * The Object type * * @return a new thread-safe {@link gnu.trove.map.TLongObjectMap TLongObjectMap} */ public static <T> TLongObjectMap<T> newLongMap() { return new TSynchronizedLongObjectMap<>(new TLongObjectHashMap<T>(), new Object()); }
private RAMTileBasedDataProcessor(MapWriterConfiguration configuration) { super(configuration); this.nodes = new TLongObjectHashMap<>(); this.ways = new TLongObjectHashMap<>(); this.multipolygons = new TLongObjectHashMap<>(); this.tileData = new RAMTileData[this.zoomIntervalConfiguration.getNumberOfZoomIntervals()][][]; // compute number of tiles needed on each base zoom level for (int i = 0; i < this.zoomIntervalConfiguration.getNumberOfZoomIntervals(); i++) { this.tileData[i] = new RAMTileData[this.tileGridLayouts[i].getAmountTilesHorizontal()][this.tileGridLayouts[i] .getAmountTilesVertical()]; } }
public synchronized void cache(Type type, long triggerId, long responseTotal, JSONObject event, CacheConsumer handler) { TLongObjectMap<List<CacheNode>> triggerCache = eventCache.computeIfAbsent(type, k -> new TLongObjectHashMap<>()); List<CacheNode> items = triggerCache.get(triggerId); if (items == null) { items = new LinkedList<>(); triggerCache.put(triggerId, items); } items.add(new CacheNode(responseTotal, event, handler)); }