Changeset 12187 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2017-05-15T22:57:02+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
r10674 r12187 12 12 import org.openstreetmap.josm.tools.TextTagParser; 13 13 14 /** 15 * Utility methods/constants that are useful for generic OSM tag handling. 16 */ 14 17 public final class OsmUtils { 15 18 … … 21 24 .asList("reverse", "-1")); 22 25 23 public static final String trueval = "yes"; 24 public static final String falseval = "no"; 25 public static final String reverseval = "-1"; 26 /** 27 * A value that should be used to indicate true 28 * @since 12186 29 */ 30 public static final String TRUE_VALUE = "yes"; 31 /** 32 * A value that should be used to indicate false 33 * @since 12186 34 */ 35 public static final String FALSE_VALUE = "no"; 36 /** 37 * A value that should be used to indicate that a property applies reversed on the way 38 * @since 12186 39 */ 40 public static final String REVERSE_VALUE = "-1"; 41 42 /** 43 * Discouraged synonym for {@link #TRUE_VALUE} 44 */ 45 public static final String trueval = TRUE_VALUE; 46 /** 47 * Discouraged synonym for {@link #FALSE_VALUE} 48 */ 49 public static final String falseval = FALSE_VALUE; 50 /** 51 * Discouraged synonym for {@link #REVERSE_VALUE} 52 */ 53 public static final String reverseval = REVERSE_VALUE; 26 54 27 55 private OsmUtils() { … … 29 57 } 30 58 59 /** 60 * Converts a string to a boolean value 61 * @param value The string to convert 62 * @return {@link Boolean#TRUE} if that string represents a true value, 63 * {@link Boolean#FALSE} if it represents a false value, 64 * <code>null</code> otherwise. 65 */ 31 66 public static Boolean getOsmBoolean(String value) { 32 67 if (value == null) return null; … … 37 72 } 38 73 74 /** 75 * Normalizes the OSM boolean value 76 * @param value The tag value 77 * @return The best true/false value or the old value if the input cannot be converted. 78 * @see #TRUE_VALUE 79 * @see #FALSE_VALUE 80 */ 39 81 public static String getNamedOsmBoolean(String value) { 40 82 Boolean res = getOsmBoolean(value); … … 42 84 } 43 85 86 /** 87 * Check if the value is a value indicating that a property applies reversed. 88 * @param value The value to check 89 * @return true if it is reversed. 90 */ 44 91 public static boolean isReversed(String value) { 45 92 return REVERSE_VALUES.contains(value); 46 93 } 47 94 95 /** 96 * Check if a tag value represents a boolean true value 97 * @param value The value to check 98 * @return true if it is a true value. 99 */ 48 100 public static boolean isTrue(String value) { 49 101 return TRUE_VALUES.contains(value); 50 102 } 51 103 104 /** 105 * Check if a tag value represents a boolean false value 106 * @param value The value to check 107 * @return true if it is a true value. 108 */ 52 109 public static boolean isFalse(String value) { 53 110 return FALSE_VALUES.contains(value); -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r12042 r12187 762 762 } else if ("BOOLEAN_TRUE".equals(n)) { 763 763 valueBool = true; 764 value = OsmUtils. trueval;764 value = OsmUtils.TRUE_VALUE; 765 765 } else if ("BOOLEAN_FALSE".equals(n)) { 766 766 valueBool = true; 767 value = OsmUtils. falseval;767 value = OsmUtils.FALSE_VALUE; 768 768 } else { 769 769 value = n.startsWith("/") ? getPattern(n) : n;
Note:
See TracChangeset
for help on using the changeset viewer.