public class HistoryDataSet extends java.lang.Object implements LayerManager.LayerChangeListener
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.Long,Changeset> |
changesets |
private java.util.Map<PrimitiveId,java.util.ArrayList<HistoryOsmPrimitive>> |
data
the history data
|
private static HistoryDataSet |
historyDataSet
the unique instance
|
private java.util.concurrent.CopyOnWriteArrayList<HistoryDataSetListener> |
listeners |
| Constructor and Description |
|---|
HistoryDataSet()
Constructs a new
HistoryDataSet. |
| Modifier and Type | Method and Description |
|---|---|
void |
addHistoryDataSetListener(HistoryDataSetListener listener)
Adds a listener that listens to history data set events.
|
protected void |
fireCacheCleared() |
protected void |
fireHistoryUpdated(PrimitiveId id) |
HistoryOsmPrimitive |
get(long id,
OsmPrimitiveType type,
long version)
Replies the history primitive for the primitive with id
id
and version version. |
java.util.Collection<java.lang.Long> |
getChangesetIds()
Gets a unsorted set of all changeset ids that were used by the primitives in this data set
|
History |
getHistory(long id,
OsmPrimitiveType type)
Replies the history for a given primitive with id
id
and type type. |
History |
getHistory(PrimitiveId pid)
Replies the history for a primitive with id
id. |
static HistoryDataSet |
getInstance()
Replies the unique instance of the history data set
|
void |
layerAdded(LayerManager.LayerAddEvent e)
Notifies this listener that a layer has been added.
|
void |
layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Notifies this listener that the order of layers was changed.
|
void |
layerRemoving(LayerManager.LayerRemoveEvent e)
Notifies this listener that a alayer was just removed.
|
void |
mergeInto(HistoryDataSet other)
merges the histories from the
HistoryDataSet other in this history data set |
void |
put(HistoryOsmPrimitive primitive)
Adds a history primitive to the data set
|
void |
putChangeset(Changeset changeset)
Adds a changeset to the data set
|
void |
removeHistoryDataSetListener(HistoryDataSetListener listener)
Removes a listener that listens to history data set events.
|
private static HistoryDataSet historyDataSet
private final java.util.Map<PrimitiveId,java.util.ArrayList<HistoryOsmPrimitive>> data
private final java.util.concurrent.CopyOnWriteArrayList<HistoryDataSetListener> listeners
private final java.util.Map<java.lang.Long,Changeset> changesets
public HistoryDataSet()
HistoryDataSet.public static HistoryDataSet getInstance()
public void addHistoryDataSetListener(HistoryDataSetListener listener)
listener - The listenerpublic void removeHistoryDataSetListener(HistoryDataSetListener listener)
listener - The listenerprotected void fireHistoryUpdated(PrimitiveId id)
protected void fireCacheCleared()
public HistoryOsmPrimitive get(long id, OsmPrimitiveType type, long version)
id
and version version. null, if no such primitive exists.id - the id of the primitive. > 0 required.type - the primitive type. Must not be null.version - the version of the primitive. > 0 requiredid,
type type, and version versionpublic void put(HistoryOsmPrimitive primitive)
primitive - the history primitive to addpublic void putChangeset(Changeset changeset)
changeset - the changeset to addpublic History getHistory(long id, OsmPrimitiveType type)
id
and type type.id - the id the if of the primitive. > 0 requiredtype - the type of the primitive. Must not be null.id and
type.java.lang.IllegalArgumentException - if id <= 0java.lang.IllegalArgumentException - if type is nullpublic History getHistory(PrimitiveId pid)
id. null, if no
such history exists.pid - the primitive id. Must not be null.id. null, if no
such history existsjava.lang.IllegalArgumentException - if pid is nullpublic void mergeInto(HistoryDataSet other)
HistoryDataSet other in this history data setother - the other history data set. Ignored if null.public java.util.Collection<java.lang.Long> getChangesetIds()
public void layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
LayerManager.LayerChangeListenerListeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
layerOrderChanged in interface LayerManager.LayerChangeListenere - The order change event.public void layerAdded(LayerManager.LayerAddEvent e)
LayerManager.LayerChangeListenerListeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
layerAdded in interface LayerManager.LayerChangeListenere - The new added layer eventpublic void layerRemoving(LayerManager.LayerRemoveEvent e)
LayerManager.LayerChangeListener
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.
layerRemoving in interface LayerManager.LayerChangeListenere - The layer to be removed (as event)