Ignore:
Timestamp:
2009-06-28T11:37:21+02:00 (17 years ago)
Author:
Gubaer
Message:

new: history feature implemented

Location:
trunk/src/org/openstreetmap/josm/data/osm/history
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java

    r1670 r1709  
    99
    1010public class HistoryDataSet {
     11
     12    private static HistoryDataSet historyDataSet;
     13
     14    public static HistoryDataSet getInstance() {
     15        if (historyDataSet == null) {
     16            historyDataSet = new HistoryDataSet();
     17        }
     18        return  historyDataSet;
     19    }
    1120
    1221    private HashMap<Long, ArrayList<HistoryOsmPrimitive>> data;
     
    4453        ArrayList<HistoryOsmPrimitive> versions = data.get(id);
    4554        if (versions == null)
    46             throw new NoSuchElementException(tr("Didn't find an historized primitive with id {0} in this dataset", id));
     55            return null;
    4756        return new History(id, versions);
    4857    }
     58
     59    /**
     60     * merges the histories from the {@see HistoryDataSet} other in this history data set
     61     *
     62     * @param other the other history data set. Ignored if null.
     63     */
     64    public void mergeInto(HistoryDataSet other) {
     65        if (other == null)
     66            return;
     67        for (Long id : other.data.keySet()) {
     68            if (!this.data.keySet().contains(id)) {
     69                this.data.put(id, other.data.get(id));
     70            }
     71        }
     72    }
    4973}
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java

    r1670 r1709  
    22package org.openstreetmap.josm.data.osm.history;
    33
     4import java.util.Collections;
    45import java.util.Date;
    56import java.util.HashMap;
     7import java.util.Map;
    68
    79import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    116118    }
    117119
     120    public Map<String,String> getTags() {
     121        return Collections.unmodifiableMap(tags);
     122    }
     123
    118124    @Override
    119125    public int hashCode() {
Note: See TracChangeset for help on using the changeset viewer.