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) |
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() |
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 layer is about to be 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) |
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)
public void removeHistoryDataSetListener(HistoryDataSetListener listener)
protected 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 version
public 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.LayerChangeListener
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
layerOrderChanged
in interface LayerManager.LayerChangeListener
e
- The order change event.public void layerAdded(LayerManager.LayerAddEvent e)
LayerManager.LayerChangeListener
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
layerAdded
in interface LayerManager.LayerChangeListener
e
- The new added layer eventpublic void layerRemoving(LayerManager.LayerRemoveEvent e)
LayerManager.LayerChangeListener
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
layerRemoving
in interface LayerManager.LayerChangeListener
e
- The layer to be removed (as event)