Class HistoryDataSet
java.lang.Object
org.openstreetmap.josm.data.osm.history.HistoryDataSet
- All Implemented Interfaces:
LayerManager.LayerChangeListener
A data set holding histories of OSM primitives.
- Since:
- 1670, 10386 (new LayerChangeListener interface)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<PrimitiveId,ArrayList<HistoryOsmPrimitive>> the history dataprivate static HistoryDataSetthe unique instanceprivate final CopyOnWriteArrayList<HistoryDataSetListener> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a listener that listens to history data set events.voidclear()Clear the history data.protected voidprotected voidget(long id, OsmPrimitiveType type, long version) Replies the history primitive for the primitive with ididand versionversion.Gets a unsorted set of all changeset ids that were used by the primitives in this data setgetHistory(long id, OsmPrimitiveType type) Replies the history for a given primitive with ididand typetype.getHistory(PrimitiveId pid) Replies the history for a primitive with idid.static HistoryDataSetReplies the unique instance of the history data setvoidNotifies this listener that a layer has been added.voidNotifies this listener that the order of layers was changed.voidNotifies this listener that a layer was just removed.voidmergeInto(HistoryDataSet other) merges the histories from theHistoryDataSetother in this history data setvoidput(HistoryOsmPrimitive primitive) Adds a history primitive to the data setvoidputChangeset(Changeset changeset) Adds a changeset to the data setvoidRemoves a listener that listens to history data set events.
-
Field Details
-
historyDataSet
the unique instance -
data
the history data -
listeners
-
changesets
-
-
Constructor Details
-
HistoryDataSet
public HistoryDataSet()Constructs a newHistoryDataSet.
-
-
Method Details
-
getInstance
Replies the unique instance of the history data set- Returns:
- the unique instance of the history data set
-
addHistoryDataSetListener
Adds a listener that listens to history data set events.- Parameters:
listener- The listener
-
removeHistoryDataSetListener
Removes a listener that listens to history data set events.- Parameters:
listener- The listener
-
fireHistoryUpdated
-
fireCacheCleared
-
get
Replies the history primitive for the primitive with ididand versionversion. null, if no such primitive exists.- Parameters:
id- the id of the primitive. > 0 required.type- the primitive type. Must not be null.version- the version of the primitive. > 0 required- Returns:
- the history primitive for the primitive with id
id, typetype, and versionversion
-
put
Adds a history primitive to the data set- Parameters:
primitive- the history primitive to add
-
putChangeset
Adds a changeset to the data set- Parameters:
changeset- the changeset to add
-
getHistory
Replies the history for a given primitive with ididand typetype.- Parameters:
id- the id the if of the primitive. > 0 requiredtype- the type of the primitive. Must not be null.- Returns:
- the history. null, if there isn't a history for
idandtype. - Throws:
IllegalArgumentException- if id <= 0IllegalArgumentException- if type is null
-
getHistory
Replies the history for a primitive with idid. null, if no such history exists.- Parameters:
pid- the primitive id. Must not be null.- Returns:
- the history for a primitive with id
id. null, if no such history exists - Throws:
NullPointerException- if pid is null
-
mergeInto
merges the histories from theHistoryDataSetother in this history data set- Parameters:
other- the other history data set. Ignored if null.
-
getChangesetIds
Gets a unsorted set of all changeset ids that were used by the primitives in this data set- Returns:
- The ids
-
layerOrderChanged
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that the order of layers was changed.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerOrderChangedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The order change event.
-
layerAdded
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer has been added.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerAddedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The new added layer event
-
layerRemoving
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer was just removed.Listeners are called in the EDT thread after the layer was removed. Use
LayerManager.LayerRemoveEvent.scheduleRemoval(Collection)to remove more layers. You should not do blocking or long-running tasks in this method.- Specified by:
layerRemovingin interfaceLayerManager.LayerChangeListener- Parameters:
e- The layer to be removed (as event)
-
clear
Clear the history data.- Since:
- 17471
-