source: josm/trunk/src/org/openstreetmap/josm/data/osm/TigerUtils.java@ 3166

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

removed usage of tab stops

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. Copyright 2007 by Dave Hansen and others
2package org.openstreetmap.josm.data.osm;
3
4import java.util.Set;
5import java.util.TreeSet;
6
7/**
8 * A simple class to keep helper functions for merging TIGER data
9 *
10 * @author daveh
11 *
12 */
13public class TigerUtils {
14
15 public static boolean isTigerTag(String tag)
16 {
17 if (tag.indexOf("tiger:") == -1)
18 return false;
19 return true;
20 }
21
22 public static boolean tagIsInt(String name) {
23 if (name.equals("tiger:tlid"))
24 return true;
25 return false;
26 }
27
28 public static Object tagObj(String name) {
29 if (tagIsInt(name))
30 return new Integer(name);
31 return name;
32 }
33
34 public static String combineTags(String name, Set<String> values) {
35 TreeSet<Object> resultSet = new TreeSet<Object>();
36 for (String value: values) {
37 for (String part: value.split(":")) {
38 resultSet.add(tagObj(part));
39 }
40 }
41 String combined = "";
42 for (Object part : resultSet) {
43 if (combined.length() > 0)
44 combined += ":";
45 combined += part;
46 }
47 return combined;
48 }
49
50 public static String combineTags(String name, String t1, String t2) {
51 Set<String> set = new TreeSet<String>();
52 set.add(t1);
53 set.add(t2);
54 return TigerUtils.combineTags(name, set);
55 }
56}
Note: See TracBrowser for help on using the repository browser.