~ubuntu-branches/ubuntu/oneiric/mkgmap/oneiric

« back to all changes in this revision

Viewing changes to src/uk/me/parabola/mkgmap/general/MapPointMultiMap.java

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine, Andreas Putzo, Francesco Paolo Lovergine
  • Date: 2009-07-16 11:10:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090716111016-yycxqya1f26xmti7
Tags: 0.0.0+svn1067-1
[ Andreas Putzo ]
* New upstream snapshot.
* Added ${misc:Depends} among dependencies to fix a lintian warning.
* Bumped debhelper compatibility level to 7.
* Updated long description.
* Updated Homepage in debian/control, debian/copyright, debian/watch.
* Added numerous files from /doc to debian/docs.
* Mentioned Bernhard Heibler in debian/copyright and updated copyright
  year of software and packaging.
* Bumped policy to 3.8.2, without changes.
* Added DM-Upload-Allowed to debian/control.

[ Francesco Paolo Lovergine ]
* Added me as Uploader to avoid possible inappropriate NMU notices.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2009 Bernhard Heibler
 
3
 * 
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License version 2 as
 
6
 *  published by the Free Software Foundation.
 
7
 * 
 
8
 *  This program is distributed in the hope that it will be useful,
 
9
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 *  GNU General Public License for more details.
 
12
 * 
 
13
 *      This is multimap to store city information for the Address Locator
 
14
 *
 
15
 *
 
16
 * Author: Bernhard Heibler
 
17
 * Create date: 02-Jan-2009
 
18
 */
 
19
 
 
20
package uk.me.parabola.mkgmap.general;
 
21
 
 
22
import java.util.ArrayList;
 
23
import java.util.Collection;
 
24
import java.util.HashMap;
 
25
import java.util.Map;
 
26
 
 
27
public class MapPointMultiMap{
 
28
 
 
29
        private final Map<String,ArrayList<MapPoint>> map  = new HashMap<String, ArrayList<MapPoint>>();
 
30
 
 
31
        public MapPoint put(String name, MapPoint p)
 
32
        {
 
33
                ArrayList<MapPoint> list;
 
34
                
 
35
                list = map.get(name);
 
36
                
 
37
                if(list == null){
 
38
 
 
39
                   list = new ArrayList<MapPoint>();
 
40
                   list.add(p);         
 
41
                   map.put(name, list);
 
42
                }
 
43
                else
 
44
                   list.add(p);
 
45
                
 
46
                return p;
 
47
        }
 
48
 
 
49
        public MapPoint get(String name)
 
50
        {
 
51
                ArrayList<MapPoint> list;
 
52
                
 
53
                list = map.get(name);
 
54
                
 
55
                if(list != null)                
 
56
                        return list.get(0);
 
57
                else
 
58
                        return null;
 
59
        }
 
60
           
 
61
        public Collection<MapPoint> getList(String name)
 
62
        {
 
63
                return map.get(name);
 
64
        }
 
65
}