public class HistoryDataSet extends Object implements MapView.LayerChangeListener
Modifier and Type | Field and Description |
---|---|
private Map<Long,Changeset> |
changesets |
private Map<PrimitiveId,ArrayList<HistoryOsmPrimitive>> |
data
the history data
|
private static HistoryDataSet |
historyDataSet
the unique instance
|
private 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 . null, if no such primitive exists. |
Collection<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 . null, if no
such history exists. |
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 Map<PrimitiveId,ArrayList<HistoryOsmPrimitive>> data
private CopyOnWriteArrayList<HistoryDataSetListener> listeners
private Map<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 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
.IllegalArgumentException
- thrown if id <= 0IllegalArgumentException
- thrown if type is nullpublic History getHistory(PrimitiveId pid) throws IllegalArgumentException
id
. null, if no
such history exists.pid
- the primitive id. Must not be null.id
. null, if no
such history existsIllegalArgumentException
- 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 Collection<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