MCPcopy Create free account
hub / github.com/akeranen/the-one / getSetting

Method getSetting

core/Settings.java:360–390  ·  view source on GitHub ↗

Returns a String-valued setting. Setting is first looked from the namespace that is set (if any) and then from the secondary namespace (if any). All other getters use this method as their first step too (so all getters may throw SettingsError and look from both namespaces). @param name Name of the s

(String name)

Source from the content-addressed store, hash-verified

358 * the namespaces
359 */
360 public String getSetting(String name) {
361 String fullPropName;
362 if (props == null) {
363 init(null);
364 }
365 fullPropName = getFullPropertyName(name, false);
366 String value = props.getProperty(fullPropName);
367
368 if (value != null) { // found value, check if run setting can be parsed
369 value = parseRunSetting(value.trim());
370 }
371
372 if ((value == null || value.length() == 0) &&
373 this.secondaryNamespace != null) {
374 // try secondary namespace if the value wasn't found from primary
375 fullPropName = getFullPropertyName(name, true);
376 value = props.getProperty(fullPropName);
377
378 if (value != null) {
379 value = parseRunSetting(value.trim());
380 }
381 }
382
383 if (value == null || value.length() == 0) {
384 throw new SettingsError("Can't find setting " +
385 getPropertyNamesString(name));
386 }
387
388 outputSetting(fullPropName + " = " + value);
389 return value;
390 }
391
392 /**
393 * Returns the given setting if it exists, or defaultValue if the setting

Callers 15

readMapMethod · 0.95
ExternalMovementMethod · 0.95
readPoisOfMethod · 0.95
containsMethod · 0.95
getDoubleMethod · 0.95
getCsvSettingMethod · 0.95
getBooleanMethod · 0.95
getConditionMethod · 0.95
valueFillStringMethod · 0.95
SimScenarioMethod · 0.95
createHostsMethod · 0.95
setupMethod · 0.95

Calls 7

initMethod · 0.95
getFullPropertyNameMethod · 0.95
parseRunSettingMethod · 0.95
outputSettingMethod · 0.95
containsMethod · 0.95
getPropertyMethod · 0.45

Tested by 5

testGetSettingMethod · 0.64
testRunIndexMethod · 0.64
testInvalidRunIndexMethod · 0.64
testNoRunMethod · 0.64
testMapCacheMethod · 0.64