本文整理了Java中com.graphhopper.util.Helper.toLowerCase()
方法的一些代码示例,展示了Helper.toLowerCase()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.toLowerCase()
方法的具体详情如下:
包路径:com.graphhopper.util.Helper
类名称:Helper
方法名:toLowerCase
暂无
代码示例来源:origin: graphhopper/graphhopper
public TranslationHashMap put(String key, String val) {
String existing = map.put(toLowerCase(key), val);
if (existing != null)
throw new IllegalStateException("Cannot overwrite key " + key + " with " + val + ", was: " + existing);
return this;
}
代码示例来源:origin: graphhopper/graphhopper
/**
* Replaces all characters which are not numbers, characters or underscores with underscores
*/
public static String weightingToFileName(Weighting w) {
return toLowerCase(w.toString()).replaceAll("\\|", "_");
}
代码示例来源:origin: graphhopper/graphhopper
public synchronized String get(String key) {
if (!key.equals(toLowerCase(key)))
throw new IllegalArgumentException("Do not use upper case keys (" + key + ") for StorableProperties since 0.7");
String ret = map.get(key);
if (ret == null)
return "";
return ret;
}
代码示例来源:origin: graphhopper/graphhopper
public Directory put(String name, DAType type) {
if (!name.equals(toLowerCase(name)))
throw new IllegalArgumentException("Since 0.7 DataAccess objects does no longer accept upper case names");
types.put(name, type);
return this;
}
代码示例来源:origin: graphhopper/graphhopper
/**
* Before it saves this value it creates a string out of it.
*/
public synchronized StorableProperties put(String key, Object val) {
if (!key.equals(toLowerCase(key)))
throw new IllegalArgumentException("Do not use upper case keys (" + key + ") for StorableProperties since 0.7");
map.put(key, val.toString());
return this;
}
代码示例来源:origin: graphhopper/graphhopper
public static double stringToTons(String value) {
value = toLowerCase(value).replaceAll(" ", "").replaceAll("(tons|ton)", "t");
value = value.replace("mgw", "").trim();
double factor = 1;
if (value.endsWith("t")) {
value = value.substring(0, value.length() - 1);
} else if (value.endsWith("lbs")) {
value = value.substring(0, value.length() - 3);
factor = 0.00045359237;
}
return Double.parseDouble(value) * factor;
}
代码示例来源:origin: graphhopper/graphhopper
@Override
public String tr(String key, Object... params) {
String val = map.get(toLowerCase(key));
if (isEmpty(val))
return key;
return String.format(Locale.ROOT, val, params);
}
代码示例来源:origin: graphhopper/graphhopper
public String getVehicle() {
return toLowerCase(super.get("vehicle", ""));
}
代码示例来源:origin: graphhopper/graphhopper
public String getWeighting() {
return toLowerCase(super.get("weighting", ""));
}
代码示例来源:origin: graphhopper/graphhopper
/**
* This method creates a CmdArgs object from the specified string array (a list of key=value pairs).
*/
public static CmdArgs read(String[] args) {
Map<String, String> map = new LinkedHashMap<>();
for (String arg : args) {
int index = arg.indexOf("=");
if (index <= 0) {
continue;
}
String key = arg.substring(0, index);
if (key.startsWith("-")) {
key = key.substring(1);
}
if (key.startsWith("-")) {
key = key.substring(1);
}
String value = arg.substring(index + 1);
String old = map.put(toLowerCase(key), value);
if (old != null)
throw new IllegalArgumentException("Pair '" + toLowerCase(key) + "'='" + value + "' not possible to " +
"add to the CmdArgs-object as the key already exists with '" + old + "'");
}
return new CmdArgs(map);
}
代码示例来源:origin: graphhopper/graphhopper
/**
* Enables the use of contraction hierarchies to reduce query times. Enabled by default.
*
* @param weightingList A list containing multiple weightings like: "fastest", "shortest" or
* your own weight-calculation type.
*/
public CHAlgoFactoryDecorator setWeightingsAsStrings(List<String> weightingList) {
if (weightingList.isEmpty())
throw new IllegalArgumentException("It is not allowed to pass an emtpy weightingList");
weightingsAsStrings.clear();
for (String strWeighting : weightingList) {
strWeighting = toLowerCase(strWeighting);
strWeighting = strWeighting.trim();
addWeighting(strWeighting);
}
return this;
}
代码示例来源:origin: graphhopper/graphhopper
/**
* Enables the use of contraction hierarchies to reduce query times. Enabled by default.
*
* @param weightingList A list containing multiple weightings like: "fastest", "shortest" or
* your own weight-calculation type.
*/
public LMAlgoFactoryDecorator setWeightingsAsStrings(List<String> weightingList) {
if (weightingList.isEmpty())
throw new IllegalArgumentException("It is not allowed to pass an emtpy weightingList");
weightingsAsStrings.clear();
for (String strWeighting : weightingList) {
strWeighting = toLowerCase(strWeighting);
strWeighting = strWeighting.trim();
addWeighting(strWeighting);
}
return this;
}
代码示例来源:origin: graphhopper/graphhopper
/**
* Removes any characters in the String that we don't care about in the matching procedure
* TODO Currently limited to certain 'western' languages
*/
private String prepareName(String name) {
// \s = A whitespace character: [ \t\n\x0B\f\r]
String[] arr = name.split("\\s");
List<String> list = new ArrayList<>(arr.length);
for (int i = 0; i < arr.length; i++) {
String rewrite = NON_WORD_CHAR.matcher(toLowerCase(arr[i])).replaceAll("");
String tmp = rewriteMap.get(rewrite);
if (tmp != null)
rewrite = tmp;
// Ignore matching short frases like de, la, ...
if (!rewrite.isEmpty() && rewrite.length() > 2) {
list.add(rewrite);
}
}
return listToString(list);
}
代码示例来源:origin: graphhopper/graphhopper
public static double stringToMeter(String value) {
value = toLowerCase(value).replaceAll(" ", "").replaceAll("(meters|meter|mtrs|mtr|mt|m\\.)", "m");
double factor = 1;
double offset = 0;
代码示例来源:origin: graphhopper/graphhopper
static List<FlagEncoder> parseEncoderString(FlagEncoderFactory factory, String encoderList) {
if (encoderList.contains(":"))
throw new IllegalArgumentException("EncodingManager does no longer use reflection instantiate encoders directly.");
if (!encoderList.equals(toLowerCase(encoderList)))
throw new IllegalArgumentException("Since 0.7 EncodingManager does no longer accept upper case profiles: " + encoderList);
String[] entries = encoderList.split(",");
List<FlagEncoder> resultEncoders = new ArrayList<>();
for (String entry : entries) {
entry = toLowerCase(entry.trim());
if (entry.isEmpty())
continue;
String entryVal = "";
if (entry.contains("|")) {
entryVal = entry;
entry = entry.split("\\|")[0];
}
PMap configuration = new PMap(entryVal);
FlagEncoder fe = factory.createFlagEncoder(entry, configuration);
if (configuration.has("version") && fe.getVersion() != configuration.getInt("version", -1))
throw new IllegalArgumentException("Encoder " + entry + " was used in version "
+ configuration.getLong("version", -1) + ", but current version is " + fe.getVersion());
resultEncoders.add(fe);
}
return resultEncoders;
}
代码示例来源:origin: graphhopper/graphhopper
String id = jsonIdField.isEmpty() || toLowerCase(jsonIdField).equals("id") ? jsonFeature.getId() : (String) jsonFeature.getProperty(jsonIdField);
if (id == null || id.isEmpty())
throw new IllegalArgumentException("ID cannot be empty but was for JsonFeature " + jsonFeatureIdx);
代码示例来源:origin: graphhopper/graphhopper
String getFileName(double lat, double lon) {
int lonInt = getMinLonForTile(lon);
int latInt = getMinLatForTile(lat);
return toLowerCase(getLatString(latInt) + getNorthString(latInt) + getLonString(lonInt) + getEastString(lonInt) + FILE_NAME_END);
}
代码示例来源:origin: graphhopper/graphhopper
String getFileName(double lat, double lon) {
int lonInt = getMinLonForTile(lon);
int latInt = getMinLatForTile(lat);
return toLowerCase(getNorthString(latInt) + getLatString(latInt) + getEastString(lonInt) + getLonString(lonInt));
}
代码示例来源:origin: graphhopper/graphhopper
@Override
public DataAccess find(String name, DAType type) {
if (!name.equals(toLowerCase(name)))
throw new IllegalArgumentException("Since 0.7 DataAccess objects does no longer accept upper case names");
DataAccess da = map.get(name);
if (da != null) {
if (!type.equals(da.getType()))
throw new IllegalStateException("Found existing DataAccess object '" + name
+ "' but types did not match. Requested:" + type + ", was:" + da.getType());
return da;
}
if (type.isInMemory()) {
if (type.isInteg()) {
if (type.isStoring())
da = new RAMIntDataAccess(name, location, true, byteOrder);
else
da = new RAMIntDataAccess(name, location, false, byteOrder);
} else if (type.isStoring())
da = new RAMDataAccess(name, location, true, byteOrder);
else
da = new RAMDataAccess(name, location, false, byteOrder);
} else if (type.isMMap()) {
da = new MMapDataAccess(name, location, byteOrder, type.isAllowWrites());
} else {
da = new UnsafeDataAccess(name, location, byteOrder);
}
map.put(name, da);
return da;
}
代码示例来源:origin: graphhopper/graphhopper
String weightingStr = toLowerCase(hintsMap.getWeighting());
Weighting weighting = null;
内容来源于网络,如有侵权,请联系作者删除!