com.graphhopper.util.Helper.toLowerCase()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中com.graphhopper.util.Helper.toLowerCase()方法的一些代码示例,展示了Helper.toLowerCase()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.toLowerCase()方法的具体详情如下:
包路径:com.graphhopper.util.Helper
类名称:Helper
方法名:toLowerCase

Helper.toLowerCase介绍

暂无

代码示例

代码示例来源:origin: graphhopper/graphhopper

  1. public TranslationHashMap put(String key, String val) {
  2. String existing = map.put(toLowerCase(key), val);
  3. if (existing != null)
  4. throw new IllegalStateException("Cannot overwrite key " + key + " with " + val + ", was: " + existing);
  5. return this;
  6. }

代码示例来源:origin: graphhopper/graphhopper

  1. /**
  2. * Replaces all characters which are not numbers, characters or underscores with underscores
  3. */
  4. public static String weightingToFileName(Weighting w) {
  5. return toLowerCase(w.toString()).replaceAll("\\|", "_");
  6. }

代码示例来源:origin: graphhopper/graphhopper

  1. public synchronized String get(String key) {
  2. if (!key.equals(toLowerCase(key)))
  3. throw new IllegalArgumentException("Do not use upper case keys (" + key + ") for StorableProperties since 0.7");
  4. String ret = map.get(key);
  5. if (ret == null)
  6. return "";
  7. return ret;
  8. }

代码示例来源:origin: graphhopper/graphhopper

  1. public Directory put(String name, DAType type) {
  2. if (!name.equals(toLowerCase(name)))
  3. throw new IllegalArgumentException("Since 0.7 DataAccess objects does no longer accept upper case names");
  4. types.put(name, type);
  5. return this;
  6. }

代码示例来源:origin: graphhopper/graphhopper

  1. /**
  2. * Before it saves this value it creates a string out of it.
  3. */
  4. public synchronized StorableProperties put(String key, Object val) {
  5. if (!key.equals(toLowerCase(key)))
  6. throw new IllegalArgumentException("Do not use upper case keys (" + key + ") for StorableProperties since 0.7");
  7. map.put(key, val.toString());
  8. return this;
  9. }

代码示例来源:origin: graphhopper/graphhopper

  1. public static double stringToTons(String value) {
  2. value = toLowerCase(value).replaceAll(" ", "").replaceAll("(tons|ton)", "t");
  3. value = value.replace("mgw", "").trim();
  4. double factor = 1;
  5. if (value.endsWith("t")) {
  6. value = value.substring(0, value.length() - 1);
  7. } else if (value.endsWith("lbs")) {
  8. value = value.substring(0, value.length() - 3);
  9. factor = 0.00045359237;
  10. }
  11. return Double.parseDouble(value) * factor;
  12. }

代码示例来源:origin: graphhopper/graphhopper

  1. @Override
  2. public String tr(String key, Object... params) {
  3. String val = map.get(toLowerCase(key));
  4. if (isEmpty(val))
  5. return key;
  6. return String.format(Locale.ROOT, val, params);
  7. }

代码示例来源:origin: graphhopper/graphhopper

  1. public String getVehicle() {
  2. return toLowerCase(super.get("vehicle", ""));
  3. }

代码示例来源:origin: graphhopper/graphhopper

  1. public String getWeighting() {
  2. return toLowerCase(super.get("weighting", ""));
  3. }

代码示例来源:origin: graphhopper/graphhopper

  1. /**
  2. * This method creates a CmdArgs object from the specified string array (a list of key=value pairs).
  3. */
  4. public static CmdArgs read(String[] args) {
  5. Map<String, String> map = new LinkedHashMap<>();
  6. for (String arg : args) {
  7. int index = arg.indexOf("=");
  8. if (index <= 0) {
  9. continue;
  10. }
  11. String key = arg.substring(0, index);
  12. if (key.startsWith("-")) {
  13. key = key.substring(1);
  14. }
  15. if (key.startsWith("-")) {
  16. key = key.substring(1);
  17. }
  18. String value = arg.substring(index + 1);
  19. String old = map.put(toLowerCase(key), value);
  20. if (old != null)
  21. throw new IllegalArgumentException("Pair '" + toLowerCase(key) + "'='" + value + "' not possible to " +
  22. "add to the CmdArgs-object as the key already exists with '" + old + "'");
  23. }
  24. return new CmdArgs(map);
  25. }

代码示例来源:origin: graphhopper/graphhopper

  1. /**
  2. * Enables the use of contraction hierarchies to reduce query times. Enabled by default.
  3. *
  4. * @param weightingList A list containing multiple weightings like: "fastest", "shortest" or
  5. * your own weight-calculation type.
  6. */
  7. public CHAlgoFactoryDecorator setWeightingsAsStrings(List<String> weightingList) {
  8. if (weightingList.isEmpty())
  9. throw new IllegalArgumentException("It is not allowed to pass an emtpy weightingList");
  10. weightingsAsStrings.clear();
  11. for (String strWeighting : weightingList) {
  12. strWeighting = toLowerCase(strWeighting);
  13. strWeighting = strWeighting.trim();
  14. addWeighting(strWeighting);
  15. }
  16. return this;
  17. }

代码示例来源:origin: graphhopper/graphhopper

  1. /**
  2. * Enables the use of contraction hierarchies to reduce query times. Enabled by default.
  3. *
  4. * @param weightingList A list containing multiple weightings like: "fastest", "shortest" or
  5. * your own weight-calculation type.
  6. */
  7. public LMAlgoFactoryDecorator setWeightingsAsStrings(List<String> weightingList) {
  8. if (weightingList.isEmpty())
  9. throw new IllegalArgumentException("It is not allowed to pass an emtpy weightingList");
  10. weightingsAsStrings.clear();
  11. for (String strWeighting : weightingList) {
  12. strWeighting = toLowerCase(strWeighting);
  13. strWeighting = strWeighting.trim();
  14. addWeighting(strWeighting);
  15. }
  16. return this;
  17. }

代码示例来源:origin: graphhopper/graphhopper

  1. /**
  2. * Removes any characters in the String that we don't care about in the matching procedure
  3. * TODO Currently limited to certain 'western' languages
  4. */
  5. private String prepareName(String name) {
  6. // \s = A whitespace character: [ \t\n\x0B\f\r]
  7. String[] arr = name.split("\\s");
  8. List<String> list = new ArrayList<>(arr.length);
  9. for (int i = 0; i < arr.length; i++) {
  10. String rewrite = NON_WORD_CHAR.matcher(toLowerCase(arr[i])).replaceAll("");
  11. String tmp = rewriteMap.get(rewrite);
  12. if (tmp != null)
  13. rewrite = tmp;
  14. // Ignore matching short frases like de, la, ...
  15. if (!rewrite.isEmpty() && rewrite.length() > 2) {
  16. list.add(rewrite);
  17. }
  18. }
  19. return listToString(list);
  20. }

代码示例来源:origin: graphhopper/graphhopper

  1. public static double stringToMeter(String value) {
  2. value = toLowerCase(value).replaceAll(" ", "").replaceAll("(meters|meter|mtrs|mtr|mt|m\\.)", "m");
  3. double factor = 1;
  4. double offset = 0;

代码示例来源:origin: graphhopper/graphhopper

  1. static List<FlagEncoder> parseEncoderString(FlagEncoderFactory factory, String encoderList) {
  2. if (encoderList.contains(":"))
  3. throw new IllegalArgumentException("EncodingManager does no longer use reflection instantiate encoders directly.");
  4. if (!encoderList.equals(toLowerCase(encoderList)))
  5. throw new IllegalArgumentException("Since 0.7 EncodingManager does no longer accept upper case profiles: " + encoderList);
  6. String[] entries = encoderList.split(",");
  7. List<FlagEncoder> resultEncoders = new ArrayList<>();
  8. for (String entry : entries) {
  9. entry = toLowerCase(entry.trim());
  10. if (entry.isEmpty())
  11. continue;
  12. String entryVal = "";
  13. if (entry.contains("|")) {
  14. entryVal = entry;
  15. entry = entry.split("\\|")[0];
  16. }
  17. PMap configuration = new PMap(entryVal);
  18. FlagEncoder fe = factory.createFlagEncoder(entry, configuration);
  19. if (configuration.has("version") && fe.getVersion() != configuration.getInt("version", -1))
  20. throw new IllegalArgumentException("Encoder " + entry + " was used in version "
  21. + configuration.getLong("version", -1) + ", but current version is " + fe.getVersion());
  22. resultEncoders.add(fe);
  23. }
  24. return resultEncoders;
  25. }

代码示例来源:origin: graphhopper/graphhopper

  1. String id = jsonIdField.isEmpty() || toLowerCase(jsonIdField).equals("id") ? jsonFeature.getId() : (String) jsonFeature.getProperty(jsonIdField);
  2. if (id == null || id.isEmpty())
  3. throw new IllegalArgumentException("ID cannot be empty but was for JsonFeature " + jsonFeatureIdx);

代码示例来源:origin: graphhopper/graphhopper

  1. String getFileName(double lat, double lon) {
  2. int lonInt = getMinLonForTile(lon);
  3. int latInt = getMinLatForTile(lat);
  4. return toLowerCase(getLatString(latInt) + getNorthString(latInt) + getLonString(lonInt) + getEastString(lonInt) + FILE_NAME_END);
  5. }

代码示例来源:origin: graphhopper/graphhopper

  1. String getFileName(double lat, double lon) {
  2. int lonInt = getMinLonForTile(lon);
  3. int latInt = getMinLatForTile(lat);
  4. return toLowerCase(getNorthString(latInt) + getLatString(latInt) + getEastString(lonInt) + getLonString(lonInt));
  5. }

代码示例来源:origin: graphhopper/graphhopper

  1. @Override
  2. public DataAccess find(String name, DAType type) {
  3. if (!name.equals(toLowerCase(name)))
  4. throw new IllegalArgumentException("Since 0.7 DataAccess objects does no longer accept upper case names");
  5. DataAccess da = map.get(name);
  6. if (da != null) {
  7. if (!type.equals(da.getType()))
  8. throw new IllegalStateException("Found existing DataAccess object '" + name
  9. + "' but types did not match. Requested:" + type + ", was:" + da.getType());
  10. return da;
  11. }
  12. if (type.isInMemory()) {
  13. if (type.isInteg()) {
  14. if (type.isStoring())
  15. da = new RAMIntDataAccess(name, location, true, byteOrder);
  16. else
  17. da = new RAMIntDataAccess(name, location, false, byteOrder);
  18. } else if (type.isStoring())
  19. da = new RAMDataAccess(name, location, true, byteOrder);
  20. else
  21. da = new RAMDataAccess(name, location, false, byteOrder);
  22. } else if (type.isMMap()) {
  23. da = new MMapDataAccess(name, location, byteOrder, type.isAllowWrites());
  24. } else {
  25. da = new UnsafeDataAccess(name, location, byteOrder);
  26. }
  27. map.put(name, da);
  28. return da;
  29. }

代码示例来源:origin: graphhopper/graphhopper

  1. String weightingStr = toLowerCase(hintsMap.getWeighting());
  2. Weighting weighting = null;

相关文章