- Timestamp:
- 2020-02-28T00:24:17+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
r15692 r15950 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import java.util.Arrays;5 4 import java.util.Collection; 6 import java.util.HashSet;7 5 import java.util.Locale; 8 6 import java.util.Map; 9 import java.util.Set;10 7 import java.util.regex.Pattern; 11 8 import java.util.stream.Stream; … … 19 16 */ 20 17 public final class OsmUtils { 21 22 private static final Set<String> TRUE_VALUES = new HashSet<>(Arrays23 .asList("true", "yes", "1", "on"));24 private static final Set<String> FALSE_VALUES = new HashSet<>(Arrays25 .asList("false", "no", "0", "off"));26 private static final Set<String> REVERSE_VALUES = new HashSet<>(Arrays27 .asList("reverse", "-1"));28 18 29 19 /** … … 70 60 if (value == null) return null; 71 61 String lowerValue = value.toLowerCase(Locale.ENGLISH); 72 if ( TRUE_VALUES.contains(lowerValue)) return Boolean.TRUE;73 if ( FALSE_VALUES.contains(lowerValue)) return Boolean.FALSE;62 if (isTrue(lowerValue)) return Boolean.TRUE; 63 if (isFalse(lowerValue)) return Boolean.FALSE; 74 64 return null; 75 65 } … … 93 83 */ 94 84 public static boolean isReversed(String value) { 95 return REVERSE_VALUES.contains(value); 85 switch (value) { 86 case "reverse": 87 case "-1": 88 return true; 89 default: 90 return false; 91 } 96 92 } 97 93 … … 102 98 */ 103 99 public static boolean isTrue(String value) { 104 return TRUE_VALUES.contains(value); 100 switch (value) { 101 case "true": 102 case "yes": 103 case "1": 104 case "on": 105 return true; 106 default: 107 return false; 108 } 105 109 } 106 110 … … 111 115 */ 112 116 public static boolean isFalse(String value) { 113 return FALSE_VALUES.contains(value); 117 switch (value) { 118 case "false": 119 case "no": 120 case "0": 121 case "off": 122 return true; 123 default: 124 return false; 125 } 114 126 } 115 127
Note:
See TracChangeset
for help on using the changeset viewer.