public abstract class HistoryOsmPrimitive extends Object implements Comparable<HistoryOsmPrimitive>
Modifier and Type | Field and Description |
---|---|
private Changeset |
changeset |
private long |
changesetId |
private long |
id |
private Map<String,String> |
tags |
private Date |
timestamp |
private User |
user |
private long |
version |
private boolean |
visible |
Constructor and Description |
---|
HistoryOsmPrimitive(long id,
long version,
boolean visible,
User user,
long changesetId,
Date timestamp)
Constructs a new
HistoryOsmPrimitive . |
HistoryOsmPrimitive(long id,
long version,
boolean visible,
User user,
long changesetId,
Date timestamp,
boolean checkHistoricParams)
Constructs a new
HistoryOsmPrimitive with a configurable checking of historic parameters. |
HistoryOsmPrimitive(OsmPrimitive p)
Constructs a new
HistoryOsmPrimitive from an existing OsmPrimitive . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(HistoryOsmPrimitive o) |
protected void |
ensurePositiveLong(long value,
String name) |
boolean |
equals(Object obj) |
static HistoryOsmPrimitive |
forOsmPrimitive(OsmPrimitive p)
|
String |
get(String key) |
Changeset |
getChangeset() |
long |
getChangesetId() |
abstract String |
getDisplayName(HistoryNameFormatter formatter)
Replies the display name of a primitive formatted by
formatter |
long |
getId() |
String |
getLocalName()
Replies the a localized name for this primitive given by the value of the tags (in this order)
name:lang_COUNTRY_Variant of the current locale
name:lang_COUNTRY of the current locale
name:lang of the current locale
name of the current locale
null, if no such tag exists
|
String |
getName()
Replies the name of this primitive.
|
PrimitiveId |
getPrimitiveId() |
Map<String,String> |
getTags() |
Date |
getTimestamp() |
abstract OsmPrimitiveType |
getType() |
User |
getUser() |
long |
getVersion() |
int |
hashCode() |
boolean |
hasTag(String key) |
boolean |
isVisible() |
boolean |
matches(long id) |
boolean |
matches(long id,
long version) |
void |
put(String key,
String value) |
void |
setChangeset(Changeset changeset) |
void |
setTags(Map<String,String> tags)
Sets the tags for this history primitive.
|
String |
toString() |
private long id
private boolean visible
private long changesetId
private long version
public HistoryOsmPrimitive(long id, long version, boolean visible, User user, long changesetId, Date timestamp) throws IllegalArgumentException
HistoryOsmPrimitive
.id
- the id (> 0 required)version
- the version (> 0 required)visible
- whether the primitive is still visibleuser
- the user (!= null required)changesetId
- the changeset id (> 0 required)timestamp
- the timestamp (!= null required)IllegalArgumentException
- if preconditions are violatedpublic HistoryOsmPrimitive(long id, long version, boolean visible, User user, long changesetId, Date timestamp, boolean checkHistoricParams) throws IllegalArgumentException
HistoryOsmPrimitive
with a configurable checking of historic parameters.
This is needed to build virtual HistoryOsmPrimitives for modified primitives, which do not have a timestamp and a changeset id.id
- the id (> 0 required)version
- the version (> 0 required)visible
- whether the primitive is still visibleuser
- the user (!= null required)changesetId
- the changeset id (> 0 required if checkHistoricParams
is true)timestamp
- the timestamp (!= null required if checkHistoricParams
is true)checkHistoricParams
- if true, checks values of changesetId
and timestamp
IllegalArgumentException
- if preconditions are violatedpublic HistoryOsmPrimitive(OsmPrimitive p)
HistoryOsmPrimitive
from an existing OsmPrimitive
.p
- the primitiveprotected final void ensurePositiveLong(long value, String name)
public static HistoryOsmPrimitive forOsmPrimitive(OsmPrimitive p)
p
- the primitiveHistoryNode
, HistoryWay
or HistoryRelation
from p
.public long getId()
public PrimitiveId getPrimitiveId()
public boolean isVisible()
public long getChangesetId()
public Date getTimestamp()
public long getVersion()
public boolean matches(long id, long version)
public boolean matches(long id)
public abstract OsmPrimitiveType getType()
public int compareTo(HistoryOsmPrimitive o)
compareTo
in interface Comparable<HistoryOsmPrimitive>
public Changeset getChangeset()
public void setChangeset(Changeset changeset)
public void setTags(Map<String,String> tags)
tags
is null.tags
- the tags. May be null.public String getName()
public abstract String getDisplayName(HistoryNameFormatter formatter)
formatter
formatter
- The formatter used to generate a display namepublic String getLocalName()