public class HistoryDataSet extends java.lang.Object implements MapView.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 |
activeLayerChange(Layer oldLayer,
Layer newLayer)
Notifies this listener that the active layer has changed.
|
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(Layer newLayer)
Notifies this listener that a layer has been added.
|
void |
layerRemoved(Layer oldLayer)
Notifies this listener that a layer has been 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 java.util.Map<PrimitiveId,java.util.ArrayList<HistoryOsmPrimitive>> data
private java.util.concurrent.CopyOnWriteArrayList<HistoryDataSetListener> listeners
private 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) throws java.lang.IllegalArgumentException
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
- thrown if id <= 0java.lang.IllegalArgumentException
- thrown if type is nullpublic History getHistory(PrimitiveId pid) throws java.lang.IllegalArgumentException
id
. null, if no
such history exists.pid
- the primitive id. Must not be null.id
. null, if no
such history existsjava.lang.IllegalArgumentException
- thrown 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 activeLayerChange(Layer oldLayer, Layer newLayer)
MapView.LayerChangeListener
activeLayerChange
in interface MapView.LayerChangeListener
oldLayer
- The previous active layernewLayer
- The new activer layerpublic void layerAdded(Layer newLayer)
MapView.LayerChangeListener
layerAdded
in interface MapView.LayerChangeListener
newLayer
- The new added layerpublic void layerRemoved(Layer oldLayer)
MapView.LayerChangeListener
layerRemoved
in interface MapView.LayerChangeListener
oldLayer
- The old removed layer