name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
graphhopper_ArrayUtil_merge_rdh
/** * * @param a * sorted array * @param b * sorted array * @return sorted array consisting of the elements of a and b, duplicates get removed */ public static int[] merge(int[] a, int[] b) { if ((a.length + b.length) == 0) return new int[]{ }; int[] v30 = new int[a.length + b.length]; ...
3.26
graphhopper_ArrayUtil_removeConsecutiveDuplicates_rdh
/** * Removes all duplicate elements of the given array in the range [0, end[ in place * * @return the size of the new range that contains no duplicates (smaller or equal to end). */ public static int removeConsecutiveDuplicates(int[] arr, int end) { int curr = 0; for (int i = 1; i < end; ++i) { ...
3.26
graphhopper_ArrayUtil_constant_rdh
/** * Creates an IntArrayList of a given size where each element is set to the given value */ public static IntArrayList constant(int size, int value) { IntArrayList result = new IntArrayList(size); Arrays.fill(result.buffer, value); result.elementsCount = size; return result; }
3.26
graphhopper_GraphHopperWeb_setPostRequest_rdh
/** * Use new endpoint 'POST /route' instead of 'GET /route' */ public GraphHopperWeb setPostRequest(boolean postRequest) { this.postRequest = postRequest; return this; }
3.26
graphhopper_GraphHopperWeb_setOptimize_rdh
/** * * @param optimize * "false" if the order of the locations should be left * unchanged, this is the default. Or if "true" then the order of the * location is optimized according to the overall best route and returned * this way i.e. the traveling salesman problem is solved under the hood. * Note th...
3.26
graphhopper_CHStorageBuilder_addShortcutEdgeBased_rdh
/** * * @param origKeyFirst * The first original edge key that is skipped by this shortcut *in the direction of the shortcut*. * This definition assumes that edge-based shortcuts are one-directional, and they are. * For example for the following shortcut edge from x to y: x->u->v->w->y , * which skips the...
3.26
graphhopper_ValueExpressionVisitor_isValidIdentifier_rdh
// allow only methods and other identifiers (constants and encoded values) boolean isValidIdentifier(String identifier) { if (variableValidator.isValid(identifier)) { if (!Character.isUpperCase(identifier.charAt(0))) result.guessedVariables.add(identifier); return true; } ...
3.26
graphhopper_UrbanDensityCalculator_calcUrbanDensity_rdh
/** * Calculates the urban density (rural/residential/city) for all edges of the graph. * First a weighted road density is calculated for every edge to determine whether it belongs to a residential area. * In a second step very dense residential areas are classified as 'city'. * * @param residentialAreaRadius * ...
3.26
graphhopper_BBox_createInverse_rdh
/** * Prefills BBox with minimum values so that it can increase. */public static BBox createInverse(boolean elevation) { if (elevation) { return new BBox(Double.MAX_VALUE, -Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, true); } else { return new B...
3.26
graphhopper_BBox_calculateIntersection_rdh
/** * Calculates the intersecting BBox between this and the specified BBox * * @return the intersecting BBox or null if not intersecting */ public BBox calculateIntersection(BBox bBox) { if (!this.intersects(bBox)) return null; double minLon = Math.max(this.minLon, bBox.minLon); double maxLon =...
3.26
graphhopper_BBox_parseBBoxString_rdh
/** * This method creates a BBox out of a string in format lon1,lon2,lat1,lat2 */ public static BBox parseBBoxString(String objectAsString) { String[] splittedObject = objectAsString.split(","); if (splittedObject.length != 4) throw new IllegalArgumentException("BBox should have 4 parts but was " + objectAsString); ...
3.26
graphhopper_BBox_intersects_rdh
/** * This method calculates if this BBox intersects with the specified BBox */ public boolean intersects(double minLon, double maxLon, double minLat, double maxLat) { return (((this.minLon < maxLon) && (this.minLat < maxLat)) && (minLon < this.maxLon)) && (minLat < this.maxLat); }
3.26
graphhopper_BBox_parseTwoPoints_rdh
/** * This method creates a BBox out of a string in format lat1,lon1,lat2,lon2 */ public static BBox parseTwoPoints(String objectAsString) { String[] splittedObject = objectAsString.split(","); if (splittedObject.length != 4) throw new IllegalArgumentException("BBox should have 4 parts but was " + objectAsString); d...
3.26
graphhopper_PrepareRoutingSubnetworks_setMinNetworkSize_rdh
/** * All components of the graph with less than 2*{@link #minNetworkSize} directed edges (edge keys) will be marked * as subnetworks. The biggest component will never be marked as subnetwork, even when it is below this size. */ public PrepareRoutingSubnetworks setMinNetworkSize(int minNetworkSize) { this.minNe...
3.26
graphhopper_PrepareRoutingSubnetworks_doWork_rdh
/** * Finds and marks all subnetworks according to {@link #setMinNetworkSize(int)} * * @return the total number of marked edges */ public int doWork() { if (minNetworkSize <= 0) { f0.info("Skipping subnetwork search: prepare.min_network_size: " + minNetworkSize); return 0; } StopWatch sw...
3.26
graphhopper_BitUtil_toSignedInt_rdh
/** * Converts the specified long back into a signed int (reverse method for toUnsignedLong) */ public static int toSignedInt(long x) { return ((int) (x)); }
3.26
graphhopper_BitUtil_toBitString_rdh
/** * Higher order bits comes first in the returned string. */ public String toBitString(byte[] bytes) { StringBuilder sb = new StringBuilder(bytes.length * 8); byte lastBit = ((byte) (1 << 7)); for (int bIndex = bytes.length - 1; bIndex >= 0; bIndex--) { byte b = bytes[bIndex]; for (int ...
3.26
graphhopper_BitUtil_toLong_rdh
/** * See the counterpart {@link #fromLong(long)} */public final long toLong(byte[] b) { return toLong(b, 0); }
3.26
graphhopper_BitUtil_toUnsignedLong_rdh
/** * This method handles the specified (potentially negative) int as unsigned bit representation * and returns the positive converted long. */ public static long toUnsignedLong(int x) { return ((long) (x)) & 0xffffffffL; }
3.26
graphhopper_BikeCommonAverageSpeedParser_applyMaxSpeed_rdh
/** * * @param way * needed to retrieve tags * @param speed * speed guessed e.g. from the road type or other tags * @return The assumed average speed. */ double applyMaxSpeed(ReaderWay way, double speed, boolean bwd) { double maxSpeed = getMaxSpeed(way, bwd); // We strictly obey speed limits, see #6...
3.26
graphhopper_WayToEdgesMap_reserve_rdh
/** * We need to reserve a way before we can put the associated edges into the map. * This way we can define a set of keys/ways for which we shall add edges later. */ public void reserve(long way) { offsetIndexByWay.put(way, RESERVED); }
3.26
graphhopper_FindMinMax_splitIntoBlocks_rdh
/** * Splits the specified list into several list of statements starting with if */ private static List<List<Statement>> splitIntoBlocks(List<Statement> statements) { List<List<Statement>> result = new ArrayList<>(); List<Statement> block = null; for (Statement st : statements) { if (IF.equals(st....
3.26
graphhopper_FindMinMax_checkLMConstraints_rdh
/** * This method throws an exception when this CustomModel would decrease the edge weight compared to the specified * baseModel as in such a case the optimality of A* with landmarks can no longer be guaranteed (as the preparation * is based on baseModel). */ public static void checkLMConstraints(CustomModel baseMo...
3.26
graphhopper_FindMinMax_findMinMax_rdh
/** * This method returns the smallest value possible in "min" and the smallest value that cannot be * exceeded by any edge in max. */ static MinMax findMinMax(Set<String> createdObjects, MinMax minMax, List<Statement> statements, EncodedValueLookup lookup) { // 'blocks' of the statements are applied one aft...
3.26
graphhopper_OSMReader_addEdge_rdh
/** * This method is called for each segment an OSM way is split into during the second pass of {@link WaySegmentParser}. * * @param fromIndex * a unique integer id for the first node of this segment * @param toIndex * a unique integer id for the last node of this segment * @param pointList * coordinates ...
3.26
graphhopper_OSMReader_getDataDate_rdh
/** * * @return the timestamp given in the OSM file header or null if not found */ public Date getDataDate() { return osmDataDate; }
3.26
graphhopper_OSMReader_processRelation_rdh
/** * This method is called for each relation during the second pass of {@link WaySegmentParser} * We use it to save the relations and process them afterwards. */ protected void processRelation(ReaderRelation relation, LongToIntFunction getIdForOSMNodeId) { if (turnCostStorage != null) if (RestrictionConvert...
3.26
graphhopper_OSMReader_preprocessWay_rdh
/** * This method is called for each way during the second pass and before the way is split into edges. * We currently use it to parse road names and calculate the distance of a way to determine the speed based on * the duration tag when it is present. The latter cannot be done on a per-edge basis, because the durat...
3.26
graphhopper_OSMReader_preprocessRelations_rdh
/** * This method is called for each relation during the first pass of {@link WaySegmentParser} */ protected void preprocessRelations(ReaderRelation relation) { if ((!relation.isMetaRelation()) && relation.hasTag("type", "route")) { // we keep track of all route relations, so they are available when we create edg...
3.26
graphhopper_OSMReader_calcDistance_rdh
/** * * @return the distance of the given way or NaN if some nodes were missing */ private double calcDistance(ReaderWay way, WaySegmentParser.CoordinateSupplier coordinateSupplier) { LongArrayList nodes = way.getNodes(); // every way has at least two nodes according to our acceptWay function GHPoint3D prevPoint = ...
3.26
graphhopper_OSMReader_acceptWay_rdh
/** * This method is called for each way during the first and second pass of the {@link WaySegmentParser}. All OSM * ways that are not accepted here and all nodes that are not referenced by any such way will be ignored. */ protected boolean acceptWay(ReaderWay way) { // ignore broken geometry if (way.getNodes().s...
3.26
graphhopper_OSMReader_setArtificialWayTags_rdh
/** * This method is called during the second pass of {@link WaySegmentParser} and provides an entry point to enrich * the given OSM way with additional tags before it is passed on to the tag parsers. */ protected void setArtificialWayTags(PointList pointList, ReaderWay way, double distance, List<Map<String, Object>...
3.26
graphhopper_OSMReader_setFile_rdh
/** * Sets the OSM file to be read. Supported formats include .osm.xml, .osm.gz and .xml.pbf */ public OSMReader setFile(File osmFile) { this.osmFile = osmFile; return this; }
3.26
graphhopper_OSMReader_isCalculateWayDistance_rdh
/** * * @return true if the length of the way shall be calculated and added as an artificial way tag */ protected boolean isCalculateWayDistance(ReaderWay way) { return isFerry(way); }
3.26
graphhopper_WayToEdgeConverter_convertForViaNode_rdh
/** * Finds the edge IDs associated with the given OSM ways that are adjacent to the given via-node. * For each way there can be multiple edge IDs and there should be exactly one that is adjacent to the via-node * for each way. Otherwise we throw {@link OSMRestrictionException} */ public Nod...
3.26
graphhopper_WayToEdgeConverter_convertForViaWays_rdh
/** * Finds the edge IDs associated with the given OSM ways that are adjacent to each other. For example for given * from-, via- and to-ways there can be multiple edges associated with each (because each way can be split into * multiple edges). We then need to find the from-edge that is connected with one of the via...
3.26
graphhopper_WayToEdgeConverter_getNodes_rdh
/** * All the intermediate nodes, i.e. for an edge chain like this: * <pre> * a b c d * 0---1---2---3---4 * </pre> * where 'a' is the from-edge and 'd' is the to-edge this will be [1,2,3] */ public IntArrayList getNodes() { return nodes; }
3.26
graphhopper_VectorTileEncoder_clipCovers_rdh
/** * A short circuit clip to the tile extent (tile boundary + buffer) for * points to improve performance. This method can be overridden to change * clipping behavior. See also {@link #clipGeometry(Geometry)}. * * @param geom * a {@link Geometry} to check for "covers" * @return a boolean true when the current...
3.26
graphhopper_VectorTileEncoder_addFeature_rdh
/** * Add a feature with layer name (typically feature type name), some attributes * and a Geometry. The Geometry must be in "pixel" space 0,0 upper left and * 256,256 lower right. * <p> * For optimization, geometries will be clipped and simplified. Features with * geometries outside of the tile will be skipped. ...
3.26
graphhopper_VectorTileEncoder_commands_rdh
/** * // // // Ex.: MoveTo(3, 6), LineTo(8, 12), LineTo(20, 34), ClosePath // * Encoded as: [ 9 3 6 18 5 6 12 22 15 ] // == command type 7 (ClosePath), * length 1 // ===== relative LineTo(+12, +22) == LineTo(20, 34) // === * relative LineTo(+5, +6) == LineTo(8, 12) // == [00010 010] = command type * 2 (LineTo), le...
3.26
graphhopper_VectorTileEncoder_encode_rdh
/** * * @return a byte array with the vector tile */ public byte[] encode() { VectorTile.Tile.Builder tile = Tile.newBuilder(); for (Map.Entry<String, Layer> e : layers.entrySet()) { String layerName = e.getKey(); Layer layer = e.getValue(); VectorTile.Tile.Layer.Builder tileLayer = T...
3.26
graphhopper_VectorTileEncoder_clipGeometry_rdh
/** * Clip geometry according to buffer given at construct time. This method * can be overridden to change clipping behavior. See also * {@link #clipCovers(Geometry)}. * * @param geometry * a {@link Geometry} to check for intersection with the current clip geometry * @return a boolean true when current clip ge...
3.26
graphhopper_FootAccessParser_getAccess_rdh
/** * Some ways are okay but not separate for pedestrians. */ public WayAccess getAccess(ReaderWay way) { String highwayValue = way.getTag("highway"); if (highwayValue == null) { WayAccess acceptPotentially = WayAccess.CAN_SKIP; if (FerrySpeedCalculator.isFerry(way)) { String f...
3.26
graphhopper_DijkstraOneToMany_getMemoryUsageAsString_rdh
/** * List currently used memory in MB (approximately) */ public String getMemoryUsageAsString() { long len = weights.length; return ((((((8L + 4L) + 4L) * len) + (changedNodes.getCapacity() * 4L)) + (heap.getCapacity() * (4L + 4L))) / Helper.MB) + "MB"; }
3.26
graphhopper_DijkstraOneToMany_clear_rdh
/** * Call clear if you have a different start node and need to clear the cache. */ public DijkstraOneToMany clear() { doClear = true; return this; }
3.26
graphhopper_EdgeBasedTarjanSCC_findComponentsForStartEdges_rdh
/** * Like {@link #findComponents(Graph, EdgeTransitionFilter, boolean)}, but the search only starts at the * given edges. This does not mean the search cannot expand to other edges, but this can be controlled by the * edgeTransitionFilter. This method does not return single edge components (the excludeSingleEdgeCom...
3.26
graphhopper_EdgeBasedTarjanSCC_findComponentsRecursive_rdh
/** * Runs Tarjan's algorithm in a recursive way. Doing it like this requires a large stack size for large graphs, * which can be set like `-Xss1024M`. Usually the version using an explicit stack ({@link #findComponents()}) should be * preferred. However, this recursive implementation is easier to understand. * * ...
3.26
graphhopper_EdgeBasedTarjanSCC_findComponents_rdh
/** * Runs Tarjan's algorithm using an explicit stack. * * @param edgeTransitionFilter * Only edge transitions accepted by this filter will be considered when we explore the graph. * If a turn is not accepted the corresponding path will be ignored (edges that are only connected * by a path with such a turn ...
3.26
graphhopper_EdgeBasedTarjanSCC_getSingleEdgeComponents_rdh
/** * The set of edge-keys that form their own (single-edge key) component. If {@link EdgeBasedTarjanSCC#excludeSingleEdgeComponents} * is enabled this set will be empty. */ public BitSet getSingleEdgeComponents() { return singleEdgeComponents;}
3.26
graphhopper_ReaderRelation_getRef_rdh
/** * member reference which is an OSM ID */ public long getRef() { return f0; }
3.26
graphhopper_PointList_copy_rdh
/** * This method does a deep copy of this object for the specified range. * * @param from * the copying of the old PointList starts at this index * @param end * the copying of the old PointList ends at the index before (i.e. end is exclusive) */ public PointList copy(int from, int end) { if (from > end)...
3.26
graphhopper_PointList_m2_rdh
/** * Clones this PointList. If this PointList was immutable, the cloned will be mutable. If this PointList was a * {@link ShallowImmutablePointList}, the cloned PointList will be a regular PointList. */ public PointList m2(boolean reverse) { PointList clonePL = new PointList(size(), is3D()); if (is3D()) ...
3.26
graphhopper_PointList_makeImmutable_rdh
/** * Once immutable, there is no way to make this object mutable again. This is done to ensure the consistency of * shallow copies. If you need to modify this object again, you have to create a deep copy of it. */ public PointList makeImmutable() { this.isImmutable = true; return this; }
3.26
graphhopper_PointList_parse2DJSON_rdh
/** * Takes the string from a json array ala [lon1,lat1], [lon2,lat2], ... and fills the list from * it. */ public void parse2DJSON(String str) { for (String latlon : str.split("\\[")) { if (latlon.trim().length() == 0) continue; String[] ll = latlon.split(",")...
3.26
graphhopper_PointList_shallowCopy_rdh
/** * Create a shallow copy of this Pointlist from from to end, excluding end. * * @param makeImmutable * makes this PointList immutable. If you don't ensure the consistency it might happen that due to changes of this * object, the shallow copy might contain incorrect or corrupt data. */ public PointList shal...
3.26
graphhopper_GHMatrixBatchRequester_setMaxIterations_rdh
/** * Internal parameter. Increase only if you have very large matrices. */ public GHMatrixBatchRequester setMaxIterations(int maxIterations) { this.maxIterations = maxIterations; return this; }
3.26
graphhopper_LandmarkSuggestion_readLandmarks_rdh
/** * The expected format is lon,lat per line where lines starting with characters will be ignored. You can create * such a file manually via geojson.io -> Save as CSV. Optionally add a second line with * <pre>#BBOX:minLat,minLon,maxLat,maxLon</pre> * <p> * to specify an explicit bounding b...
3.26
graphhopper_TourStrategy_m0_rdh
/** * Modifies the Distance up to +-10% */ protected double m0(double distance) { double distanceModification = (random.nextDouble() * 0.1) * distance; if (random.nextBoolean()) distanceModification = -distanceModification; return distance + distanceModification; }
3.26
graphhopper_MiniPerfTest_getMin_rdh
/** * * @return minimum time of every call, in ms */ public double getMin() { return min / NS_PER_MS; }
3.26
graphhopper_MiniPerfTest_getMax_rdh
/** * * @return maximum time of every calls, in ms */public double getMax() {return max / NS_PER_MS; }
3.26
graphhopper_MiniPerfTest_getMean_rdh
/** * * @return mean time per call, in ms */ public double getMean() { return getSum() / counts; }
3.26
graphhopper_MiniPerfTest_getSum_rdh
/** * * @return time for all calls accumulated, in ms */ public double getSum() { return fullTime / NS_PER_MS; }
3.26
graphhopper_MiniPerfTest_start_rdh
/** * Important: Make sure to use the dummy sum in your program somewhere such that it's calculation cannot be skipped * by the JVM. Either use {@link #getDummySum()} or {@link #getReport()} after running this method. */ public MiniPerfTest start(Task m) { int warmupCount = Math.max(1, counts / 3); for (int...
3.26
graphhopper_PbfFieldDecoder_decodeString_rdh
/** * Decodes a raw string into a String. * <p> * * @param rawString * The PBF encoding string. * @return The string as a String. */ public String decodeString(int rawString) { return strings[rawString]; }
3.26
graphhopper_PbfFieldDecoder_decodeLongitude_rdh
/** * Decodes a raw longitude value into degrees. * <p> * * @param rawLongitude * The PBF encoded value. * @return The longitude in degrees. */ public double decodeLongitude(long rawLongitude) { return COORDINATE_SCALING_FACTOR * (coordLongitudeOffset + (coordGranularity * rawLongitude)); }
3.26
graphhopper_PbfFieldDecoder_m0_rdh
/** * Decodes a raw timestamp value into a Date. * <p> * * @param rawTimestamp * The PBF encoded timestamp. * @return The timestamp as a Date. */ public Date m0(long rawTimestamp) { return new Date(dateGranularity * rawTimestamp); }
3.26
graphhopper_PbfFieldDecoder_decodeLatitude_rdh
/** * Decodes a raw latitude value into degrees. * <p> * * @param rawLatitude * The PBF encoded value. * @return The latitude in degrees. */ public double decodeLatitude(long rawLatitude) {return COORDINATE_SCALING_FACTOR * (coordLatitudeOffset + (coordGranularity * rawLatitude)); }
3.26
graphhopper_BaseGraph_copyProperties_rdh
/** * This method copies the properties of one {@link EdgeIteratorState} to another. * * @return the updated iterator the properties where copied to. */ EdgeIteratorState copyProperties(EdgeIteratorState from, EdgeIteratorStateImpl to) { long edgePointer = store.toEdgePointer(to.getEdge()); store.writeF...
3.26
graphhopper_BaseGraph_flushAndCloseGeometryAndNameStorage_rdh
/** * Flush and free resources that are not needed for post-processing (way geometries and KVStorage for edges). */ public void flushAndCloseGeometryAndNameStorage() { setWayGeometryHeader();wayGeometry.flush(); wayGeometry.close(); edgeKVStorage.flush(); edgeKVStorage.close(); }
3.26
graphhopper_BaseGraph_init_rdh
/** * Similar to {@link #init(int edgeId, int adjNode)}, but here we retrieve the edge in a certain direction * directly using an edge key. */ final void init(int edgeKey) { if (edgeKey < 0) throw new IllegalArgumentException("edge keys must not be negative, given: " + edgeKey); this.edgeI...
3.26
graphhopper_BaseGraph_m1_rdh
// todo: maybe rename later, but for now this makes it easier to replace GraphBuilder public Builder m1(boolean withTurnCosts) { this.withTurnCosts = withTurnCosts; return this; }
3.26
graphhopper_GraphHopper_process_rdh
/** * Creates the graph from OSM data. */ protected void process(boolean closeEarly) { GHDirectory directory = new GHDirectory(ghLocation, dataAccessDefaultType); directory.configure(dataAccessConfig); boolean withUrbanDensity = urbanDensityCalculationThreads > 0; boolean withMaxSpeedEstimation = maxSpeedCalculator ...
3.26
graphhopper_GraphHopper_initLocationIndex_rdh
/** * Initializes the location index after the import is done. */ protected void initLocationIndex() { if (locationIndex != null)throw new IllegalStateException("Cannot initialize locationIndex twice!"); locationIndex = createLocationIndex(baseGraph.getDirectory()); }
3.26
graphhopper_GraphHopper_close_rdh
/** * Releases all associated resources like memory or files. But it does not remove them. To * remove the files created in graphhopperLocation you have to call clean(). */ public void close() { if (baseGraph != null)baseGraph.close(); if (properties != null) properties.close(); chGraphs.values().forEach(RoutingCH...
3.26
graphhopper_GraphHopper_getBaseGraph_rdh
/** * The underlying graph used in algorithms. * * @throws IllegalStateException * if graph is not instantiated. */ public BaseGraph getBaseGraph() { if (baseGraph == null) throw new IllegalStateException("GraphHopper storage not initialized"); return baseGraph;}
3.26
graphhopper_GraphHopper_setProfiles_rdh
/** * Sets the routing profiles that shall be supported by this GraphHopper instance. The (and only the) given profiles * can be used for routing without preparation and for CH/LM preparation. * <p> * Here is an example how to setup two CH profiles and one LM profile (via the Java API) * * <pre> * {@code hopper....
3.26
graphhopper_GraphHopper_setAllowWrites_rdh
/** * Specifies if it is allowed for GraphHopper to write. E.g. for read only filesystems it is not * possible to create a lock file and so we can avoid write locks. */ public GraphHopper setAllowWrites(boolean allowWrites) { this.allowWrites = allowWrites; return this; }
3.26
graphhopper_GraphHopper_postProcessing_rdh
/** * Runs both after the import and when loading an existing Graph * * @param closeEarly * release resources as early as possible */ protected void postProcessing(boolean closeEarly) { initLocationIndex(); importPublicTransit(); if (closeEarly) { boolean includesCustomProfiles = profilesByName.values().stre...
3.26
graphhopper_GraphHopper_importAndClose_rdh
/** * Imports and processes data, storing it to disk when complete. */ public void importAndClose() { if (!load()) { printInfo(); process(true); } else { printInfo(); logger.info("Graph already imported into " + ghLocation); } close(); }
3.26
graphhopper_GraphHopper_setUrbanDensityCalculation_rdh
/** * Configures the urban density classification. Each edge will be classified as 'rural','residential' or 'city', {@link UrbanDensity} * * @param residentialAreaRadius * in meters. The higher this value the longer the calculation will take and the bigger the area for * which the road density used to identify...
3.26
graphhopper_GraphHopper_cleanUp_rdh
/** * Internal method to clean up the graph. */ protected void cleanUp() { PrepareRoutingSubnetworks preparation = new PrepareRoutingSubnetworks(baseGraph.getBaseGraph(), buildSubnetworkRemovalJobs()); preparation.setMinNetworkSize(minNetworkSize); preparation.setThreads(subnetworksThreads); preparation.doWork(); pro...
3.26
graphhopper_GraphHopper_getLocationIndex_rdh
/** * The location index created from the graph. * * @throws IllegalStateException * if index is not initialized */ public LocationIndex getLocationIndex() { if (locationIndex == null) throw new IllegalStateException("LocationIndex not initialized"); return locationIndex;}
3.26
graphhopper_GraphHopper_m5_rdh
/** * For landmarks it is required to always call this method: either it creates the landmark data or it loads it. */ protected void m5(boolean closeEarly) { for (LMProfile profile : lmPreparationHandler.getLMProfiles())if ((!getLMProfileVersion(profile.getProfile()).isEmpty()) && (!getLMProfileVersion(profile.getPr...
3.26
graphhopper_GraphHopper_setGraphHopperLocation_rdh
/** * Sets the graphhopper folder. */ public GraphHopper setGraphHopperLocation(String ghLocation) { ensureNotLoaded(); if (ghLocation == null)throw new IllegalArgumentException("graphhopper location cannot be null"); this.ghLocation = ghLocation; return this; }
3.26
graphhopper_GraphHopper_importOrLoad_rdh
/** * Imports provided data from disc and creates graph. Depending on the settings the resulting * graph will be stored to disc so on a second call this method will only load the graph from * disc which is usually a lot faster. */ public GraphHopper importOrLoad() { if (!load()) { printInfo(); process(false); } els...
3.26
graphhopper_GraphHopper_load_rdh
/** * Load from existing graph folder. */ public boolean load() { if (isEmpty(ghLocation)) throw new IllegalStateException("GraphHopperLocation is not specified. Call setGraphHopperLocation or init before"); if (fullyLoaded) throw new IllegalStateException("graph is already successfully loade...
3.26
graphhopper_GraphHopper_getProfile_rdh
/** * Returns the profile for the given profile name, or null if it does not exist */ public Profile getProfile(String profileName) { return profilesByName.get(profileName); }
3.26
graphhopper_GraphHopper__getOSMFile_rdh
/** * Currently we use this for a few tests where the dataReaderFile is loaded from the classpath */ protected File _getOSMFile() { return new File(osmFile); }
3.26
graphhopper_GraphHopper_setSortGraph_rdh
/** * Sorts the graph which requires more RAM while import. See #12 */ public GraphHopper setSortGraph(boolean sortGraph) { ensureNotLoaded(); this.sortGraph = sortGraph; return this; }
3.26
graphhopper_GraphHopper_setCountryRuleFactory_rdh
/** * Sets the factory used to create country rules. Use `null` to disable country rules */ public GraphHopper setCountryRuleFactory(CountryRuleFactory countryRuleFactory) { this.countryRuleFactory = countryRuleFactory; return this; }
3.26
graphhopper_GraphHopper_setElevation_rdh
/** * Enable storing and fetching elevation data. Default is false */ public GraphHopper setElevation(boolean includeElevation) { this.elevation = includeElevation; return this; }
3.26
graphhopper_GraphHopper_setPreciseIndexResolution_rdh
/** * Precise location resolution index means also more space (disc/RAM) could be consumed and * probably slower query times, which would be e.g. not suitable for Android. The resolution * specifies the tile width (in meter). */ public GraphHopper setPreciseIndexResolution(int precision) { ensureNotLoaded(); prec...
3.26
graphhopper_GraphHopper_setStoreOnFlush_rdh
/** * Only valid option for in-memory graph and if you e.g. want to disable store on flush for unit * tests. Specify storeOnFlush to true if you want that existing data will be loaded FROM disc * and all in-memory data will be flushed TO disc after flush is called e.g. while OSM import. * * @param storeOnFlush * ...
3.26
graphhopper_GraphHopper_hasElevation_rdh
/** * * @return true if storing and fetching elevation data is enabled. Default is false */ public boolean hasElevation() { return elevation; }
3.26
graphhopper_GraphHopper_clean_rdh
/** * Removes the on-disc routing files. Call only after calling close or before importOrLoad or * load */ public void clean() { if (getGraphHopperLocation().isEmpty()) throw new IllegalStateException("Cannot clean GraphHopper without specified graphHopperLocation"); File folder = new File(getGraphHopperLocation())...
3.26
graphhopper_EdgeBasedNodeContractor_findAndHandlePrepareShortcuts_rdh
/** * This method performs witness searches between all nodes adjacent to the given node and calls the * given handler for all required shortcuts. */ private void findAndHandlePrepareShortcuts(int node, PrepareShortcutHandler shortcutHandler, int maxPolls, EdgeBasedWitnessPathSearcher.Stats wpsStats) { stats().n...
3.26
graphhopper_GHMRequest_putHint_rdh
// a good trick to serialize unknown properties into the HintsMap @JsonAnySetter public GHMRequest putHint(String fieldName, Object value) { f1.putObject(fieldName, value); return this; }
3.26
graphhopper_GHMRequest_setFailFast_rdh
/** * * @param failFast * if false the matrix calculation will be continued even when some points are not connected */ @JsonProperty("fail_fast") public void setFailFast(boolean failFast) { this.failFast = failFast; }
3.26
graphhopper_GHMRequest_setOutArrays_rdh
/** * Possible values are 'weights', 'times', 'distances' */public GHMRequest setOutArrays(List<String> outArrays) { this.outArrays = outArrays; return this; }
3.26
graphhopper_LMApproximator_initCollections_rdh
// We only expect a very short search @Override protected void initCollections(int size) { super.initCollections(2);}
3.26