source: josm/trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java@ 2555

Last change on this file since 2555 was 1169, checked in by stoecker, 15 years ago

removed usage of tab stops

File size: 1.0 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import java.util.ArrayList;
5import java.util.Arrays;
6import java.util.Locale;
7
8public class OsmUtils {
9
10 static ArrayList<String> TRUE_VALUES = new ArrayList<String>(Arrays
11 .asList(new String[] { "true", "yes", "1", "on" }));
12 static ArrayList<String> FALSE_VALUES = new ArrayList<String>(Arrays
13 .asList(new String[] { "false", "no", "0", "off" }));
14
15 public static final String trueval = "yes";
16 public static final String falseval = "no";
17
18 public static Boolean getOsmBoolean(String value) {
19 if(value == null) return null;
20 String lowerValue = value.toLowerCase(Locale.ENGLISH);
21 if (TRUE_VALUES.contains(lowerValue)) return Boolean.TRUE;
22 if (FALSE_VALUES.contains(lowerValue)) return Boolean.FALSE;
23 return null;
24 }
25 public static String getNamedOsmBoolean(String value) {
26 Boolean res = getOsmBoolean(value);
27 return res == null ? value : (res ? trueval : falseval);
28 }
29}
Note: See TracBrowser for help on using the repository browser.