name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
graphhopper_PrepareLandmarks_setMaximumWeight_rdh
/** * * @see LandmarkStorage#setMaximumWeight(double) */ public PrepareLandmarks setMaximumWeight(double maximumWeight) { lms.setMaximumWeight(maximumWeight); return this; }
3.26
graphhopper_PrepareLandmarks_setLandmarkSuggestions_rdh
/** * * @see LandmarkStorage#setLandmarkSuggestions(List) */public PrepareLandmarks setLandmarkSuggestions(List<LandmarkSuggestion> landmarkSuggestions) { lms.setLandmarkSuggestions(landmarkSuggestions);return this; }
3.26
graphhopper_PrepareLandmarks_setLMSelectionWeighting_rdh
/** * * @see LandmarkStorage#setLMSelectionWeighting(Weighting) */ public void setLMSelectionWeighting(Weighting w) { lms.setLMSelectionWeighting(w); }
3.26
graphhopper_PrepareLandmarks_setMinimumNodes_rdh
/** * * @see LandmarkStorage#setMinimumNodes(int) */ public void setMinimumNodes(int nodes) { if (nodes < 2) throw new IllegalArgumentException("minimum node count must be at least 2"); lms.setMinimumNodes(nodes); }
3.26
graphhopper_PathSimplification_updateInterval_rdh
/** * * @param p * point index * @param s * partition index */ private boolean updateInterval(int p, int s) { boolean nextIntervalHasOnlyOnePoint = false; // update interval boundaries final int v20 = currIntervalStart[s] - removedPointsInPrevIntervals[s]; final int updatedEnd = (currIntervalEnd[s] - removedPointsInPrevIntervals[s]) - removedPointsInCurrInterval[s]; this.f0.get(s).setInterval(currIntervalIndex[s], v20, updatedEnd); // update the removed point counters removedPointsInPrevIntervals[s] += removedPointsInCurrInterval[s]; removedPointsInCurrInterval[s] = 0; // prepare for the next interval currIntervalIndex[s]++; currIntervalStart[s] = p; if (currIntervalIndex[s] >= this.f0.get(s).size()) { partitionFinished[s] = true; } else { int length = this.f0.get(s).getIntervalLength(currIntervalIndex[s]); currIntervalEnd[s] += length;// special case at via points etc. if (length == 0) { nextIntervalHasOnlyOnePoint = true; } }return nextIntervalHasOnlyOnePoint; }
3.26
graphhopper_PathSimplification_simplify_rdh
/** * Convenience method used to obtain the partitions from a calculated path with details and instructions */ public static PointList simplify(ResponsePath responsePath, RamerDouglasPeucker ramerDouglasPeucker, boolean enableInstructions) { final PointList pointList = responsePath.getPoints(); List<Partition> v1 = new ArrayList<>(); // make sure all waypoints are retained in the simplified point list // we copy the waypoint indices into temporary intervals where they will be mutated by the simplification, // afterwards we need to update the way point indices accordingly. List<Interval> intervals = new ArrayList<>(); for (int i = 0; i < (responsePath.getWaypointIndices().size() - 1); i++) intervals.add(new Interval(responsePath.getWaypointIndices().get(i), responsePath.getWaypointIndices().get(i + 1))); v1.add(new Partition() { @Override public int size() { return intervals.size(); } @Override public int getIntervalLength(int index) { return intervals.get(index).end - intervals.get(index).start; } @Override public void setInterval(int index, int start, int end) { intervals.get(index).start = start;intervals.get(index).end = end; } }); // todo: maybe this code can be simplified if path details and instructions would be merged, see #1121 if (enableInstructions) { final InstructionList instructions = responsePath.getInstructions(); v1.add(new Partition() { @Override public int size() { return instructions.size(); } @Override public int getIntervalLength(int index) { return instructions.get(index).getLength(); } @Override public void setInterval(int index, int start, int end) { Instruction instruction = instructions.get(index); if ((instruction instanceof ViaInstruction) || (instruction instanceof FinishInstruction)) { if (start != end) { throw new IllegalStateException("via- and finish-instructions are expected to have zero length"); } // have to make sure that via instructions and finish instructions contain a single point // even though their 'instruction length' is zero. end++; } instruction.setPoints(pointList.shallowCopy(start, end, false)); } }); } for (final Map.Entry<String, List<PathDetail>> entry : responsePath.getPathDetails().entrySet()) { // If the pointList only contains one point, PathDetails have to be empty because 1 point => 0 edges final List<PathDetail> detail = entry.getValue(); if (detail.isEmpty() && (pointList.size() > 1)) throw new IllegalStateException(("PathDetails " + entry.getKey()) + " must not be empty"); v1.add(new Partition() { @Override public int size() { return detail.size(); } @Override public int getIntervalLength(int index) { return detail.get(index).getLength();} @Override public void setInterval(int index, int start, int end) { PathDetail pd = detail.get(index); pd.setFirst(start); pd.setLast(end); } }); } simplify(responsePath.getPoints(), v1, ramerDouglasPeucker); List<Integer> simplifiedWaypointIndices = new ArrayList<>(); simplifiedWaypointIndices.add(intervals.get(0).start); for (Interval interval : intervals) simplifiedWaypointIndices.add(interval.end); responsePath.setWaypointIndices(simplifiedWaypointIndices); assertConsistencyOfPathDetails(responsePath.getPathDetails());if (enableInstructions) assertConsistencyOfInstructions(responsePath.getInstructions(), responsePath.getPoints().size()); return pointList; }
3.26
graphhopper_Instructions_find_rdh
/** * This method is useful for navigation devices to find the next instruction for the specified * coordinate (e.g. the current position). * <p> * * @param instructions * the instructions to query * @param maxDistance * the maximum acceptable distance to the instruction (in meter) * @return the next Instruction or null if too far away. */ public static Instruction find(InstructionList instructions, double lat, double lon, double maxDistance) { // handle special cases if (instructions.size() == 0) { return null; } PointList points = instructions.get(0).getPoints(); double prevLat = points.getLat(0); double prevLon = points.getLon(0); DistanceCalc distCalc = DistanceCalcEarth.DIST_EARTH; double foundMinDistance = distCalc.calcNormalizedDist(lat, lon, prevLat, prevLon); int foundInstruction = 0; // Search the closest edge to the query point if (instructions.size() > 1) { for (int instructionIndex = 0; instructionIndex < instructions.size(); instructionIndex++) { points = instructions.get(instructionIndex).getPoints(); for (int pointIndex = 0; pointIndex < points.size(); pointIndex++) { double currLat = points.getLat(pointIndex); double currLon = points.getLon(pointIndex); if (!((instructionIndex == 0) && (pointIndex == 0))) { // calculate the distance from the point to the edge double distance; int v11 = instructionIndex; if (distCalc.validEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon)) { distance = distCalc.calcNormalizedEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon); if (pointIndex > 0) v11++; } else { distance = distCalc.calcNormalizedDist(lat, lon, currLat, currLon); if (pointIndex > 0) v11++; } if (distance < foundMinDistance) { foundMinDistance = distance; foundInstruction = v11; } } prevLat = currLat; prevLon = currLon; } } } if (distCalc.calcDenormalizedDist(foundMinDistance) > maxDistance) return null; // special case finish condition if (foundInstruction == instructions.size()) foundInstruction--; return instructions.get(foundInstruction); }
3.26
graphhopper_Entity_writeTimeField_rdh
/** * Take a time expressed in seconds since noon - 12h (midnight, usually) and write it in HH:MM:SS format. */ protected void writeTimeField(int secsSinceMidnight) throws IOException { if (secsSinceMidnight == INT_MISSING) { writeStringField(""); return; } writeStringField(convertToGtfsTime(secsSinceMidnight)); }
3.26
graphhopper_Entity_endRecord_rdh
/** * End a row. * This is just a proxy to the writer, but could be used for hooks in the future. */ public void endRecord() throws IOException { writer.endRecord(); }
3.26
graphhopper_Entity_checkRangeInclusive_rdh
/** * * @return whether the number actual is in the range [min, max] */protected boolean checkRangeInclusive(double min, double max, double actual) { if ((actual < min) || (actual > max)) { feed.errors.add(new RangeError(tableName, row, null, min, max, actual));// TODO set column name in loader so it's available in methods return false; } return true; }
3.26
graphhopper_Entity_m0_rdh
/** * Used to check referential integrity. * Return value is not used, but could allow entities to point to each other directly rather than * using indirection through string-keyed maps. */ protected <K, V> V m0(String column, boolean required, Map<K, V> target) throws IOException { String str = getFieldCheckRequired(column, required); V val = null;if (str != null) { val = target.get(str); if (val == null) { feed.errors.add(new ReferentialIntegrityError(tableName, row, column, str)); } } return val; }
3.26
graphhopper_Entity_loadTable_rdh
/** * The main entry point into an Entity.Loader. Interprets each row of a CSV file within a zip file as a sinle * GTFS entity, and loads them into a table. * * @param zipOrDirectory * the zip file or directory from which to read a table */ public void loadTable(File zipOrDirectory) throws IOException { InputStream zis; if (zipOrDirectory.isDirectory()) { Path path = zipOrDirectory.toPath().resolve(tableName + ".txt"); if (!path.toFile().exists()) { missing(); return; } zis = new FileInputStream(path.toFile()); LOG.info("Loading GTFS table {} from {}", tableName, path); } else { ZipFile zip = new ZipFile(zipOrDirectory);ZipEntry entry = zip.getEntry(tableName + ".txt"); if (entry == null) { Enumeration<? extends ZipEntry> entries = zip.entries(); // check if table is contained within sub-directory while (entries.hasMoreElements()) { ZipEntry e = entries.nextElement(); if (e.getName().endsWith(tableName + ".txt")) { entry = e; feed.errors.add(new TableInSubdirectoryError(tableName, entry.getName().replace(tableName + ".txt", ""))); } } missing(); if (entry == null) return; } zis = zip.getInputStream(entry); LOG.info("Loading GTFS table {} from {}", tableName, entry); } // skip any byte order mark that may be present. Files must be UTF-8, // but the GTFS spec says that "files that include the UTF byte order mark are acceptable" InputStream bis = new BOMInputStream(zis); CsvReader reader = new CsvReader(bis, ',', Charset.forName("UTF8")); this.reader = reader; reader.readHeaders(); while (reader.readRecord()) { // reader.getCurrentRecord() is zero-based and does not include the header line, keep our own row count if (((++row) % 500000) == 0) { LOG.info("Record number {}", human(row)); } loadOneRow();// Call subclass method to produce an entity from the current row. } }
3.26
graphhopper_Entity_getStringField_rdh
/** * * @return the given column from the current row as a deduplicated String. */ protected String getStringField(String column, boolean required) throws IOException { return getFieldCheckRequired(column, required); }
3.26
graphhopper_Entity_getDateField_rdh
/** * Fetch the given column of the current row, and interpret it as a date in the format YYYYMMDD. * * @return the date value as Java LocalDate, or null if it could not be parsed. */ protected LocalDate getDateField(String column, boolean required) throws IOException { String str = getFieldCheckRequired(column, required); LocalDate dateTime = null; if (str != null) try { dateTime = LocalDate.parse(str, DateTimeFormatter.BASIC_ISO_DATE); checkRangeInclusive(2000, 2100, dateTime.getYear()); } catch (IllegalArgumentException iae) { feed.errors.add(new DateParseError(tableName, row, column)); } return dateTime; }
3.26
graphhopper_Entity_writeDoubleField_rdh
/** * Write a double value, with precision 10^-7. NaN is written as "". */ protected void writeDoubleField(double val) throws IOException { // NaN's represent missing values if (Double.isNaN(val)) writeStringField(""); else// control file size: don't use unnecessary precision // This is usually used for coordinates; one ten-millionth of a degree at the equator is 1.1cm, // and smaller elsewhere on earth, plenty precise enough. // On Jupiter, however, it's a different story. // Use the US locale so that . is used as the decimal separator writeStringField(String.format(Locale.US, "%.7f", val)); }
3.26
graphhopper_Entity_getTimeField_rdh
/** * Fetch the given column of the current row, and interpret it as a time in the format HH:MM:SS. * * @return the time value in seconds since midnight */ protected int getTimeField(String column, boolean required) throws IOException { String str = getFieldCheckRequired(column, required); int val = INT_MISSING;if (str != null) { String[] fields = str.split(":"); if (fields.length != 3) { feed.errors.add(new TimeParseError(tableName, row, column)); } else { try { int hours = Integer.parseInt(fields[0]); int minutes = Integer.parseInt(fields[1]); int seconds = Integer.parseInt(fields[2]); checkRangeInclusive(0, 72, hours);// GTFS hours can go past midnight. Some trains run for 3 days. checkRangeInclusive(0, 59, minutes); checkRangeInclusive(0, 59, seconds); val = (((hours * 60) * 60) + (minutes * 60)) + seconds; } catch (NumberFormatException nfe) { feed.errors.add(new TimeParseError(tableName, row, column)); }} } return val; }
3.26
graphhopper_Entity_human_rdh
// shared code between reading and writing private static final String human(long n) { if (n >= 1000000) return String.format(Locale.getDefault(), "%.1fM", n / 1000000.0); if (n >= 1000) return String.format(Locale.getDefault(), "%.1fk", n / 1000.0); else return String.format(Locale.getDefault(), "%d", n); }
3.26
graphhopper_Entity_writeDateField_rdh
/** * Writes date as YYYYMMDD */protected void writeDateField(LocalDate d) throws IOException { writeStringField(d.format(DateTimeFormatter.BASIC_ISO_DATE)); }
3.26
graphhopper_Entity_getFieldCheckRequired_rdh
/** * Fetch the value from the given column of the current row. Record an error the first time a column is * seen to be missing, and whenever empty values are encountered. * I was originally just calling getStringField from the other getXField functions as a first step to get * the missing-field check. But we don't want deduplication performed on strings that aren't being retained. * Therefore the missing-field behavior is this separate function. * * @return null if column was missing or field is empty */ private String getFieldCheckRequired(String column, boolean required) throws IOException { String str = reader.get(column); if (str == null) { if (!missingRequiredColumns.contains(column)) { feed.errors.add(new MissingColumnError(tableName, column)); missingRequiredColumns.add(column); } } else if (str.isEmpty()) { if (required) { feed.errors.add(new EmptyFieldError(tableName, row, column)); } str = null; }return str; }
3.26
graphhopper_Entity_getUrlField_rdh
/** * Fetch the given column of the current row, and interpret it as a URL. * * @return the URL, or null if the field was missing or empty. */ protected URL getUrlField(String column, boolean required) throws IOException { String str = getFieldCheckRequired(column, required); URL url = null; if (str != null) try { url = new URL(str); } catch (MalformedURLException mue) { feed.errors.add(new URLParseError(tableName, row, column)); } return url; }
3.26
graphhopper_WaySegmentParser_setWorkerThreads_rdh
/** * * @param workerThreads * the number of threads used for the low level reading of the OSM file */ public Builder setWorkerThreads(int workerThreads) { waySegmentParser.workerThreads = workerThreads; return this; }
3.26
graphhopper_WaySegmentParser_readOSM_rdh
/** * * @param osmFile * the OSM file to parse, supported formats include .osm.xml, .osm.gz and .xml.pbf */ public void readOSM(File osmFile) { if (f0.getNodeCount() > 0) throw new IllegalStateException("You can only run way segment parser once"); LOGGER.info(("Start reading OSM file: '" + osmFile) + "'"); LOGGER.info("pass1 - start"); StopWatch sw1 = StopWatch.started(); readOSM(osmFile, new Pass1Handler(), new SkipOptions(true, false, false)); LOGGER.info("pass1 - finished, took: {}", sw1.stop().getTimeString()); long nodes = f0.getNodeCount(); LOGGER.info((("Creating graph. Node count (pillar+tower): " + nodes) + ", ") + Helper.getMemInfo()); LOGGER.info("pass2 - start"); StopWatch sw2 = new StopWatch().start(); readOSM(osmFile, new Pass2Handler(), SkipOptions.none()); LOGGER.info("pass2 - finished, took: {}", sw2.stop().getTimeString()); f0.release(); LOGGER.info((((((((("Finished reading OSM file." + " pass1: ") + ((int) (sw1.getSeconds()))) + "s, ") + " pass2: ") + ((int) (sw2.getSeconds()))) + "s, ") + " total: ") + ((int) (sw1.getSeconds() + sw2.getSeconds()))) + "s"); }
3.26
graphhopper_WaySegmentParser_setWayPreprocessor_rdh
/** * * @param wayPreprocessor * callback function that is called for each accepted OSM way during the second pass */public Builder setWayPreprocessor(WayPreprocessor wayPreprocessor) { waySegmentParser.wayPreprocessor = wayPreprocessor; return this; }
3.26
graphhopper_WaySegmentParser_setElevationProvider_rdh
/** * * @param elevationProvider * used to determine the elevation of an OSM node */ public Builder setElevationProvider(ElevationProvider elevationProvider) { waySegmentParser.elevationProvider = elevationProvider; return this; }
3.26
graphhopper_WaySegmentParser_getTimeStamp_rdh
/** * * @return the timestamp read from the OSM file, or null if nothing was read yet */ public Date getTimeStamp() { return timestamp; }
3.26
graphhopper_WaySegmentParser_setSplitNodeFilter_rdh
/** * * @param splitNodeFilter * return true if the given OSM node should be duplicated to create an artificial edge */ public Builder setSplitNodeFilter(Predicate<ReaderNode> splitNodeFilter) { waySegmentParser.splitNodeFilter = splitNodeFilter; return this; }
3.26
graphhopper_WaySegmentParser_setRelationProcessor_rdh
/** * * @param relationProcessor * callback function that receives OSM relations during the second pass */ public Builder setRelationProcessor(RelationProcessor relationProcessor) { waySegmentParser.relationProcessor = relationProcessor; return this; }
3.26
graphhopper_WaySegmentParser_setRelationPreprocessor_rdh
/** * * @param relationPreprocessor * callback function that receives OSM relations during the first pass */ public Builder setRelationPreprocessor(Consumer<ReaderRelation> relationPreprocessor) { waySegmentParser.relationPreprocessor = relationPreprocessor; return this;}
3.26
graphhopper_WaySegmentParser_setWayFilter_rdh
/** * * @param wayFilter * return true for OSM ways that should be considered and false otherwise */ public Builder setWayFilter(Predicate<ReaderWay> wayFilter) { waySegmentParser.wayFilter = wayFilter; return this; }
3.26
graphhopper_PbfBlobResult_storeFailureResult_rdh
/** * Stores a failure result for a blob decoding operation. */ public void storeFailureResult(Exception ex) { complete = true; success = false;this.ex = ex; }
3.26
graphhopper_PbfBlobResult_isComplete_rdh
/** * Gets the complete flag. * <p> * * @return True if complete. */ public boolean isComplete() { return complete; }
3.26
graphhopper_Country_find_rdh
/** * * @param iso * should be ISO 3166-1 alpha-2 */ public static Country find(String iso) { return ALPHA2_MAP.get(iso); }
3.26
graphhopper_Country_getCountryName_rdh
/** * * @return the name of this country. Avoids clash with name() method of this enum. */ public String getCountryName() { return countryName; }
3.26
graphhopper_Country_getAlpha2_rdh
/** * * @return the ISO 3166-1:alpha2 code of this country */ public String getAlpha2() { return alpha2; }
3.26
graphhopper_GHDirectory_getPreload_rdh
/** * Returns the preload value or 0 if no patterns match. * See {@link #configure(LinkedHashMap)} */ int getPreload(String name) { for (Map.Entry<String, Integer> entry : mmapPreloads.entrySet()) if (name.matches(entry.getKey())) return entry.getValue(); return 0; }
3.26
graphhopper_GHDirectory_getDefaultType_rdh
/** * This method returns the default DAType of the specified DataAccess (as string). If preferInts is true then this * method returns e.g. RAM_INT if the type of the specified DataAccess is RAM. */ public DAType getDefaultType(String dataAccess, boolean preferInts) {DAType type = getDefault(dataAccess, typeFallback);if (preferInts && type.isInMemory()) return type.isStoring() ? RAM_INT_STORE : RAM_INT; return type; }
3.26
graphhopper_GHDirectory_configure_rdh
/** * Configure the DAType (specified by the value) of a single DataAccess object (specified by the key). For "MMAP" you * can prepend "preload." to the name and specify a percentage which preloads the DataAccess into physical memory of * the specified percentage (only applied for load, not for import). * As keys can be patterns the order is important and the LinkedHashMap is forced as type. */ public Directory configure(LinkedHashMap<String, String> config) { for (Map.Entry<String, String> v1 : config.entrySet()) { String value = v1.getValue().trim(); if (v1.getKey().startsWith("preload.")) try { String pattern = v1.getKey().substring("preload.".length());mmapPreloads.put(pattern, Integer.parseInt(value)); } catch (NumberFormatException ex) { throw new IllegalArgumentException((("DataAccess " + v1.getKey()) + " has an incorrect preload value: ") + value); } else { String v4 = v1.getKey(); defaultTypes.put(v4, DAType.fromString(value)); } } return this; }
3.26
graphhopper_Frequency_getId_rdh
/** * Frequency entries have no ID in GTFS so we define one based on the fields in the frequency entry. * * It is possible to have two identical frequency entries in the GTFS, which under our understanding of the situation * would mean that two sets of vehicles were randomly running the same trip at the same headway, but uncorrelated * with each other, which is almost certain to be an error. */ public String getId() { StringBuilder v0 = new StringBuilder(); v0.append(trip_id); v0.append('_'); v0.append(convertToGtfsTime(start_time)); v0.append("_to_"); v0.append(convertToGtfsTime(end_time)); v0.append("_every_"); v0.append(String.format(Locale.getDefault(), "%dm%02ds", headway_secs / 60, headway_secs % 60)); if (exact_times == 1) v0.append("_exact"); return v0.toString(); }
3.26
graphhopper_Frequency_compareTo_rdh
/** * must have a comparator since they go in a navigable set that is serialized */ @Override public int compareTo(Frequency o) { return this.start_time - o.start_time; }
3.26
graphhopper_OSMReaderUtility_parseDuration_rdh
/** * Parser according to http://wiki.openstreetmap.org/wiki/Key:duration The value consists of a * string ala 'hh:mm', format for hours and minutes 'mm', 'hh:mm' or 'hh:mm:ss', or * alternatively ISO_8601 duration * <p> * * @return duration value in seconds */ public static long parseDuration(String str) throws IllegalArgumentException { if (str == null)return 0; // Check for ISO_8601 format if (str.startsWith("P")) { // A common mistake is when the minutes format is intended but the month format is specified // e.g. one month "P1M" is set, but one minute "PT1M" is meant. try { Duration dur = DatatypeFactory.newInstance().newDuration(str); return dur.getTimeInMillis(STATIC_DATE) / 1000;} catch (Exception ex) { throw new IllegalArgumentException("Cannot parse duration tag value: " + str, ex); } } try { int index = str.indexOf(":"); if (index > 0) { String hourStr = str.substring(0, index); String minStr = str.substring(index + 1);String v4 = "0"; index = minStr.indexOf(":"); if (index > 0) { v4 = minStr.substring(index + 1, index + 3); minStr = minStr.substring(0, index); } long seconds = (Integer.parseInt(hourStr) * 60L) * 60; seconds += Integer.parseInt(minStr) * 60L; seconds += Integer.parseInt(v4); return seconds; } else { // value contains minutes return Integer.parseInt(str) * 60L; } } catch (Exception ex) {throw new IllegalArgumentException("Cannot parse duration tag value: " + str, ex); } }
3.26
graphhopper_AbstractNonCHBidirAlgo_fillEdgesToUsingFilter_rdh
/** * * @see #fillEdgesFromUsingFilter(EdgeFilter) */ protected void fillEdgesToUsingFilter(EdgeFilter edgeFilter) { additionalEdgeFilter = edgeFilter; finishedTo = !fillEdgesTo(); additionalEdgeFilter = null; }
3.26
graphhopper_AbstractNonCHBidirAlgo_fillEdgesFromUsingFilter_rdh
/** * * @param edgeFilter * edge filter used to filter edges during {@link #fillEdgesFrom()} */ protected void fillEdgesFromUsingFilter(EdgeFilter edgeFilter) { additionalEdgeFilter = edgeFilter; finishedFrom = !fillEdgesFrom(); additionalEdgeFilter = null; }
3.26
graphhopper_TarjanSCC_getComponents_rdh
/** * A list of arrays each containing the nodes of a strongly connected component. Components with only a single * node are not included here, but need to be obtained using {@link #getSingleNodeComponents()}. */ public List<IntArrayList> getComponents() {return components; }
3.26
graphhopper_TarjanSCC_getSingleNodeComponents_rdh
/** * The set of nodes that form their own (single-node) component. If {@link TarjanSCC#excludeSingleNodeComponents} * is enabled this set will be empty. */ public BitSet getSingleNodeComponents() { return singleNodeComponents; }
3.26
graphhopper_TarjanSCC_getTotalComponents_rdh
/** * The total number of strongly connected components. This always includes single-node components. */ public int getTotalComponents() { return numComponents; } /** * A reference to the biggest component contained in {@link #getComponents()} or an empty list if there are * either no components or the biggest component has only a single node (and hence {@link #getComponents()}
3.26
graphhopper_TarjanSCC_findComponents_rdh
/** * Runs Tarjan's algorithm using an explicit stack. * * @param excludeSingleNodeComponents * if set to true components that only contain a single node will not be * returned when calling {@link #findComponents} or {@link #findComponentsRecursive()}, * which can be useful to save some memory. */ public static ConnectedComponents findComponents(Graph graph, EdgeFilter edgeFilter, boolean excludeSingleNodeComponents) { return new TarjanSCC(graph, edgeFilter, excludeSingleNodeComponents).findComponents(); }
3.26
graphhopper_RestrictionSetter_setRestrictions_rdh
/** * Adds all the turn restriction entries to the graph that are needed to enforce the given restrictions, for * a single turn cost encoded value. * Implementing via-way turn restrictions requires adding artificial edges to the graph, which is also handled here. * Since we keep track of the added artificial edges here it is important to only use one RestrictionSetter instance * for **all** turn restrictions and vehicle types. */ public void setRestrictions(List<Pair<GraphRestriction, RestrictionType>> restrictions, BooleanEncodedValue turnRestrictionEnc) { // we first need to add all the artificial edges, because we might need to restrict turns between artificial // edges created for different restrictions (when restrictions are overlapping) addArtificialEdges(restrictions); // now we can add all the via-way restrictions addViaWayRestrictions(restrictions, turnRestrictionEnc);// ... and finally all the via-node restrictions addViaNodeRestrictions(restrictions, turnRestrictionEnc); }
3.26
graphhopper_VectorTile_clearSintValue_rdh
/** * <code>optional sint64 sint_value = 6;</code> */ public Builder clearSintValue() { bitField0_ = bitField0_ & (~0x20); sintValue_ = 0L; onChanged(); return this;}
3.26
graphhopper_VectorTile_setSintValue_rdh
/** * <code>optional sint64 sint_value = 6;</code> */ public Builder setSintValue(long value) { bitField0_ |= 0x20; sintValue_ = value; onChanged(); return this; }
3.26
graphhopper_VectorTile_addLayersBuilder_rdh
/** * <code>repeated .vector_tile.Tile.Layer layers = 3;</code> */ public VectorTile.Tile.Layer.Builder addLayersBuilder(int index) { return getLayersFieldBuilder().addBuilder(index, VectorTile.Tile.Layer.getDefaultInstance()); }
3.26
graphhopper_VectorTile_getType_rdh
/** * <pre> * The type of geometry stored in this feature. * </pre> * * <code>optional .vector_tile.Tile.GeomType type = 3 [default = UNKNOWN];</code> */ public VectorTile.Tile.GeomType getType() { @SuppressWarnings("deprecation") VectorTile.Tile.GeomType result = VectorTile.Tile.GeomType.valueOf(type_); return result == null ? VectorTile.Tile.GeomType.UNKNOWN : result; }
3.26
graphhopper_VectorTile_hasUintValue_rdh
/** * <code>optional uint64 uint_value = 5;</code> */ public boolean hasUintValue() { return (bitField0_ & 0x10) == 0x10;}
3.26
graphhopper_VectorTile_setIntValue_rdh
/** * <code>optional int64 int_value = 4;</code> */ public Builder setIntValue(long value) { bitField0_ |= 0x8;intValue_ = value; onChanged(); return this; }
3.26
graphhopper_VectorTile_m17_rdh
/** * <code>required string name = 1;</code> */ public Builder m17() {bitField0_ = bitField0_ & (~0x2); name_ = getDefaultInstance().getName(); onChanged(); return this; }
3.26
graphhopper_VectorTile_getFeaturesBuilder_rdh
/** * <pre> * The actual features in this tile. * </pre> * * <code>repeated .vector_tile.Tile.Feature features = 2;</code> */ public VectorTile.Tile.Feature.Builder getFeaturesBuilder(int index) { return getFeaturesFieldBuilder().getBuilder(index); }
3.26
graphhopper_VectorTile_getValuesBuilder_rdh
/** * <pre> * Dictionary encoding for values * </pre> * * <code>repeated .vector_tile.Tile.Value values = 4;</code> */ public VectorTile.Tile.Value.Builder getValuesBuilder(int index) { return getValuesFieldBuilder().getBuilder(index); }
3.26
graphhopper_VectorTile_getValuesCount_rdh
/** * <pre> * Dictionary encoding for values * </pre> * * <code>repeated .vector_tile.Tile.Value values = 4;</code> */ public int getValuesCount() { if (valuesBuilder_ == null) { return values_.size(); } else { return valuesBuilder_.getCount(); } }
3.26
graphhopper_VectorTile_clearVersion_rdh
/** * <pre> * Any compliant implementation must first read the version * number encoded in this message and choose the correct * implementation for this version number before proceeding to * decode other parts of this message. * </pre> * * <code>required uint32 version = 15 [default = 1];</code> */ public Builder clearVersion() { bitField0_ = bitField0_ & (~0x1); version_ = 1; onChanged(); return this;}
3.26
graphhopper_VectorTile_getValuesList_rdh
/** * <pre> * Dictionary encoding for values * </pre> * * <code>repeated .vector_tile.Tile.Value values = 4;</code> */ public List<VectorTile.Tile.Value> getValuesList() { return values_; }
3.26
graphhopper_VectorTile_getExtent_rdh
/** * <pre> * Although this is an "optional" field it is required by the specification. * See https://github.com/mapbox/vector-tile-spec/issues/47 * </pre> * * <code>optional uint32 extent = 5 [default = 4096];</code> */ public int getExtent() {return extent_; }
3.26
graphhopper_VectorTile_getStringValueBytes_rdh
/** * <pre> * Exactly one of these values must be present in a valid message * </pre> * * <code>optional string string_value = 1;</code> */ public ByteString getStringValueBytes() { Object ref = stringValue_; if (ref instanceof String) { ByteString b = ByteString.copyFromUtf8(((String) (ref))); stringValue_ = b; return b; } else { return ((ByteString) (ref)); } }
3.26
graphhopper_VectorTile_hasDoubleValue_rdh
/** * <code>optional double double_value = 3;</code> */ public boolean hasDoubleValue() { return (bitField0_ & 0x4) == 0x4; }
3.26
graphhopper_VectorTile_clearTags_rdh
/** * <pre> * Tags of this feature are encoded as repeated pairs of * integers. * A detailed description of tags is located in sections * 4.2 and 4.4 of the specification * </pre> * * <code>repeated uint32 tags = 2 [packed = true];</code> */ public Builder clearTags() { tags_ = Collections.emptyList(); bitField0_ = bitField0_ & (~0x2); onChanged(); return this; }
3.26
graphhopper_VectorTile_m22_rdh
/** * <code>repeated .vector_tile.Tile.Layer layers = 3;</code> */ public int m22() { return layers_.size(); }
3.26
graphhopper_VectorTile_getGeometry_rdh
/** * <pre> * Contains a stream of commands and parameters (vertices). * A detailed description on geometry encoding is located in * section 4.3 of the specification. * </pre> * * <code>repeated uint32 geometry = 4 [packed = true];</code> */ public int getGeometry(int index) { return geometry_.get(index); }
3.26
graphhopper_VectorTile_hasSintValue_rdh
/** * <code>optional sint64 sint_value = 6;</code> */ public boolean hasSintValue() { return (bitField0_ & 0x20) == 0x20; }
3.26
graphhopper_VectorTile_getDoubleValue_rdh
/** * <code>optional double double_value = 3;</code> */ public double getDoubleValue() { return doubleValue_; }
3.26
graphhopper_VectorTile_clearKeys_rdh
/** * <pre> * Dictionary encoding for keys * </pre> * * <code>repeated string keys = 3;</code> */ public Builder clearKeys() { keys_ = LazyStringArrayList.EMPTY; bitField0_ = bitField0_ & (~0x8); onChanged(); return this; }
3.26
graphhopper_VectorTile_addLayers_rdh
/** * <code>repeated .vector_tile.Tile.Layer layers = 3;</code> */ public Builder addLayers(int index, VectorTile.Tile.Layer.Builder builderForValue) { if (layersBuilder_ == null) { ensureLayersIsMutable(); layers_.add(index, builderForValue.build()); onChanged(); } else { layersBuilder_.addMessage(index, builderForValue.build()); } return this; }
3.26
graphhopper_VectorTile_setUintValue_rdh
/** * <code>optional uint64 uint_value = 5;</code> */ public Builder setUintValue(long value) { bitField0_ |= 0x10; uintValue_ = value; onChanged(); return this; }
3.26
graphhopper_VectorTile_clearUintValue_rdh
/** * <code>optional uint64 uint_value = 5;</code> */ public Builder clearUintValue() { bitField0_ = bitField0_ & (~0x10); uintValue_ = 0L; onChanged(); return this; }
3.26
graphhopper_VectorTile_getLayersOrBuilder_rdh
/** * <code>repeated .vector_tile.Tile.Layer layers = 3;</code> */ public VectorTile.Tile.LayerOrBuilder getLayersOrBuilder(int index) { if (layersBuilder_ == null) { return layers_.get(index); } else { return layersBuilder_.getMessageOrBuilder(index);} }
3.26
graphhopper_VectorTile_addAllGeometry_rdh
/** * <pre> * Contains a stream of commands and parameters (vertices). * A detailed description on geometry encoding is located in * section 4.3 of the specification. * </pre> * * <code>repeated uint32 geometry = 4 [packed = true];</code> */public Builder addAllGeometry(Iterable<? extends Integer> values) { ensureGeometryIsMutable(); AbstractMessageLite.Builder.addAll(values, geometry_); onChanged(); return this; }
3.26
graphhopper_VectorTile_clearId_rdh
/** * <code>optional uint64 id = 1 [default = 0];</code> */ public Builder clearId() { bitField0_ = bitField0_ & (~0x1); id_ = 0L; onChanged(); return this; }
3.26
graphhopper_VectorTile_hasVersion_rdh
/** * <pre> * Any compliant implementation must first read the version * number encoded in this message and choose the correct * implementation for this version number before proceeding to * decode other parts of this message. * </pre> * * <code>required uint32 version = 15 [default = 1];</code> */ public boolean hasVersion() { return (bitField0_ & 0x1) == 0x1; }
3.26
graphhopper_VectorTile_getLayers_rdh
/** * <code>repeated .vector_tile.Tile.Layer layers = 3;</code> */ public VectorTile.Tile.Layer getLayers(int index) { if (layersBuilder_ == null) { return layers_.get(index); } else { return layersBuilder_.getMessage(index); }}
3.26
graphhopper_VectorTile_setName_rdh
/** * <code>required string name = 1;</code> */ public Builder setName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x2; name_ = value; onChanged(); return this; }
3.26
graphhopper_VectorTile_hasExtent_rdh
/** * <pre> * Although this is an "optional" field it is required by the specification. * See https://github.com/mapbox/vector-tile-spec/issues/47 * </pre> * * <code>optional uint32 extent = 5 [default = 4096];</code> */ public boolean hasExtent() { return (bitField0_ & 0x20) == 0x20; }
3.26
graphhopper_VectorTile_setFloatValue_rdh
/** * <code>optional float float_value = 2;</code> */ public Builder setFloatValue(float value) { bitField0_ |= 0x2; floatValue_ = value; onChanged(); return this; }
3.26
graphhopper_VectorTile_m3_rdh
/** * <code>optional double double_value = 3;</code> */ public double m3() { return doubleValue_; }
3.26
graphhopper_VectorTile_addTags_rdh
/** * <pre> * Tags of this feature are encoded as repeated pairs of * integers. * A detailed description of tags is located in sections * 4.2 and 4.4 of the specification * </pre> * * <code>repeated uint32 tags = 2 [packed = true];</code> */ public Builder addTags(int value) { ensureTagsIsMutable(); tags_.add(value); onChanged(); return this; }
3.26
graphhopper_VectorTile_getTagsList_rdh
/** * <pre> * Tags of this feature are encoded as repeated pairs of * integers. * A detailed description of tags is located in sections * 4.2 and 4.4 of the specification * </pre> * * <code>repeated uint32 tags = 2 [packed = true];</code> */ public List<Integer> getTagsList() { return Collections.unmodifiableList(tags_); }
3.26
graphhopper_VectorTile_getName_rdh
/** * <code>required string name = 1;</code> */ public String getName() { Object v92 = name_; if (!(v92 instanceof String)) { ByteString bs = ((ByteString) (v92)); String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } else { return ((String) (v92)); } }
3.26
graphhopper_VectorTile_getBoolValue_rdh
/** * <code>optional bool bool_value = 7;</code> */ public boolean getBoolValue() { return boolValue_; }
3.26
graphhopper_VectorTile_getValues_rdh
/** * <pre> * Dictionary encoding for values * </pre> * * <code>repeated .vector_tile.Tile.Value values = 4;</code> */ public VectorTile.Tile.Value getValues(int index) { if (valuesBuilder_ == null) { return values_.get(index); } else { return valuesBuilder_.getMessage(index); } }
3.26
graphhopper_VectorTile_getLayersCount_rdh
/** * <code>repeated .vector_tile.Tile.Layer layers = 3;</code> */ public int getLayersCount() { if (layersBuilder_ == null) { return layers_.size(); } else { return layersBuilder_.getCount(); } }
3.26
graphhopper_VectorTile_getLayersOrBuilderList_rdh
/** * <code>repeated .vector_tile.Tile.Layer layers = 3;</code> */ public List<? extends VectorTile.Tile.LayerOrBuilder> getLayersOrBuilderList() { if (layersBuilder_ != null) { return layersBuilder_.getMessageOrBuilderList(); } else { return Collections.unmodifiableList(layers_); } }
3.26
graphhopper_VectorTile_hasId_rdh
/** * <code>optional uint64 id = 1 [default = 0];</code> */ public boolean hasId() { return (bitField0_ & 0x1) == 0x1; }
3.26
graphhopper_VectorTile_getStringValue_rdh
/** * <pre> * Exactly one of these values must be present in a valid message * </pre> * * <code>optional string string_value = 1;</code> */ public String getStringValue() { Object ref = stringValue_; if (ref instanceof String) { return ((String) (ref)); } else { ByteString bs = ((ByteString) (ref)); String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { stringValue_ = s; } return s; } }
3.26
graphhopper_VectorTile_getFeaturesOrBuilder_rdh
/** * <pre> * The actual features in this tile. * </pre> * * <code>repeated .vector_tile.Tile.Feature features = 2;</code> */ public VectorTile.Tile.FeatureOrBuilder getFeaturesOrBuilder(int index) { if (featuresBuilder_ == null) { return features_.get(index); } else { return featuresBuilder_.getMessageOrBuilder(index); } }
3.26
graphhopper_VectorTile_addAllFeatures_rdh
/** * <pre> * The actual features in this tile. * </pre> * * <code>repeated .vector_tile.Tile.Feature features = 2;</code> */ public Builder addAllFeatures(Iterable<? extends VectorTile.Tile.Feature> values) { if (featuresBuilder_ == null) { ensureFeaturesIsMutable(); AbstractMessageLite.Builder.addAll(values, features_); onChanged(); } else { featuresBuilder_.addAllMessages(values); } return this; }
3.26
graphhopper_VectorTile_addValues_rdh
/** * <pre> * Dictionary encoding for values * </pre> * * <code>repeated .vector_tile.Tile.Value values = 4;</code> */ public Builder addValues(int index, VectorTile.Tile.Value.Builder builderForValue) { if (valuesBuilder_ == null) { ensureValuesIsMutable(); values_.add(index, builderForValue.build()); onChanged(); } else { valuesBuilder_.addMessage(index, builderForValue.build()); } return this; }
3.26
graphhopper_VectorTile_addValuesBuilder_rdh
/** * <pre> * Dictionary encoding for values * </pre> * * <code>repeated .vector_tile.Tile.Value values = 4;</code> */ public VectorTile.Tile.Value.Builder addValuesBuilder(int index) { return getValuesFieldBuilder().addBuilder(index, VectorTile.Tile.Value.getDefaultInstance()); }
3.26
graphhopper_VectorTile_getValuesOrBuilderList_rdh
/** * <pre> * Dictionary encoding for values * </pre> * * <code>repeated .vector_tile.Tile.Value values = 4;</code> */ public List<? extends VectorTile.Tile.ValueOrBuilder> getValuesOrBuilderList() { if (valuesBuilder_ != null) { return valuesBuilder_.getMessageOrBuilderList(); } else { return Collections.unmodifiableList(values_); } }
3.26
graphhopper_VectorTile_setStringValueBytes_rdh
/** * <pre> * Exactly one of these values must be present in a valid message * </pre> * * <code>optional string string_value = 1;</code> */ public Builder setStringValueBytes(ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x1; stringValue_ = value; onChanged(); return this; }
3.26
graphhopper_VectorTile_addKeysBytes_rdh
/** * <pre> * Dictionary encoding for keys * </pre> * * <code>repeated string keys = 3;</code> */ public Builder addKeysBytes(ByteString value) { if (value == null) { throw new NullPointerException(); } ensureKeysIsMutable(); keys_.add(value); onChanged(); return this; }
3.26
graphhopper_VectorTile_getFeatures_rdh
/** * <pre> * The actual features in this tile. * </pre> * * <code>repeated .vector_tile.Tile.Feature features = 2;</code> */ public VectorTile.Tile.Feature getFeatures(int index) { if (featuresBuilder_ == null) { return features_.get(index); } else { return featuresBuilder_.getMessage(index); } }
3.26
graphhopper_VectorTile_hasStringValue_rdh
/** * <pre> * Exactly one of these values must be present in a valid message * </pre> * * <code>optional string string_value = 1;</code> */ public boolean hasStringValue() { return (bitField0_ & 0x1) == 0x1; }
3.26
graphhopper_VectorTile_m16_rdh
/** * <pre> * The actual features in this tile. * </pre> * * <code>repeated .vector_tile.Tile.Feature features = 2;</code> */ public List<VectorTile.Tile.Feature> m16() { return features_; }
3.26
graphhopper_VectorTile_getNameBytes_rdh
/** * <code>required string name = 1;</code> */ public ByteString getNameBytes() { Object ref = name_; if (ref instanceof String) { ByteString b = ByteString.copyFromUtf8(((String) (ref))); name_ = b; return b; } else { return ((ByteString) (ref)); } }
3.26