public abstract class HistoryOsmPrimitive extends java.lang.Object implements Tagged, java.lang.Comparable<HistoryOsmPrimitive>
| Modifier and Type | Field and Description |
|---|---|
private Changeset |
changeset |
private long |
changesetId |
private long |
id |
private java.util.Map<java.lang.String,java.lang.String> |
tags |
private java.util.Date |
timestamp |
private User |
user |
private long |
version |
private boolean |
visible |
MAX_TAG_LENGTH| Constructor and Description |
|---|
HistoryOsmPrimitive(long id,
long version,
boolean visible,
User user,
long changesetId,
java.util.Date timestamp)
Constructs a new
HistoryOsmPrimitive. |
HistoryOsmPrimitive(long id,
long version,
boolean visible,
User user,
long changesetId,
java.util.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,
java.lang.String name)
Checks that value is positive.
|
boolean |
equals(java.lang.Object obj) |
protected void |
fillPrimitiveCommonData(PrimitiveData data)
Fills the attributes common to all primitives with values from this history.
|
static HistoryOsmPrimitive |
forOsmPrimitive(OsmPrimitive p)
|
java.lang.String |
get(java.lang.String key)
Replies the value of the given key; null, if there is no value for this key
|
Changeset |
getChangeset()
Returns the changeset for this history primitive.
|
long |
getChangesetId()
Returns the changeset id.
|
abstract java.lang.String |
getDisplayName(HistoryNameFormatter formatter)
Replies the display name of a primitive formatted by
formatter |
long |
getId()
Returns the id.
|
java.util.Map<java.lang.String,java.lang.String> |
getKeys()
Replies the map of key/value pairs.
|
java.lang.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
|
java.lang.String |
getName()
Replies the name of this primitive.
|
int |
getNumKeys()
Gets the number of keys
|
PrimitiveId |
getPrimitiveId()
Returns the primitive id.
|
java.util.Map<java.lang.String,java.lang.String> |
getTags()
Replies the key/value map.
|
java.util.Date |
getTimestamp()
Returns the timestamp.
|
abstract OsmPrimitiveType |
getType()
Returns the primitive type.
|
User |
getUser()
Returns the user.
|
long |
getVersion()
Returns the version.
|
int |
hashCode() |
boolean |
hasKey(java.lang.String key)
Replies true if there is a tag with key
key. |
boolean |
hasKeys()
Replies true, if there is at least one key/value pair; false, otherwise
|
boolean |
isVisible()
Determines if the primitive is still visible.
|
java.util.Collection<java.lang.String> |
keySet()
Replies the set of keys
|
boolean |
matches(long id)
Determines if this history matches given id.
|
boolean |
matches(long id,
long version)
Determines if this history matches given id and version.
|
void |
put(java.lang.String key,
java.lang.String value)
Sets a key/value pairs
|
void |
remove(java.lang.String key)
Removes a given key/value pair
|
void |
removeAll()
Removes all tags
|
void |
setChangeset(Changeset changeset)
Sets the changeset for this history primitive.
|
void |
setKeys(java.util.Map<java.lang.String,java.lang.String> keys)
Sets the map of key/value pairs
|
void |
setTags(java.util.Map<java.lang.String,java.lang.String> tags)
Sets the tags for this history primitive.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waithasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, put, visitKeysprivate long id
private boolean visible
private long changesetId
private java.util.Date timestamp
private long version
private java.util.Map<java.lang.String,java.lang.String> tags
public HistoryOsmPrimitive(long id, long version, boolean visible, User user, long changesetId, java.util.Date timestamp)
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)java.lang.IllegalArgumentException - if preconditions are violatedpublic HistoryOsmPrimitive(long id, long version, boolean visible, User user, long changesetId, java.util.Date timestamp, boolean checkHistoricParams)
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 timestampjava.lang.IllegalArgumentException - if preconditions are violatedpublic HistoryOsmPrimitive(OsmPrimitive p)
HistoryOsmPrimitive from an existing OsmPrimitive.p - the primitivepublic static HistoryOsmPrimitive forOsmPrimitive(OsmPrimitive p)
p - the primitiveHistoryNode, HistoryWay or HistoryRelation from p.public long getId()
public PrimitiveId getPrimitiveId()
public boolean isVisible()
true if the primitive is still visiblepublic long getChangesetId()
public java.util.Date getTimestamp()
public long getVersion()
protected final void ensurePositiveLong(long value, java.lang.String name)
value - value to checkname - parameter name for error messagejava.lang.IllegalArgumentException - if value <= 0public boolean matches(long id, long version)
id - Primitive identifierversion - Primitive versiontrue if this history matches given id and versionpublic boolean matches(long id)
id - Primitive identifiertrue if this history matches given idpublic abstract OsmPrimitiveType getType()
public int compareTo(HistoryOsmPrimitive o)
compareTo in interface java.lang.Comparable<HistoryOsmPrimitive>public final void put(java.lang.String key, java.lang.String value)
Taggedpublic final java.lang.String get(java.lang.String key)
Taggedpublic final boolean hasKey(java.lang.String key)
Taggedkey.
The value could however be empty. See Tagged.hasTag(String) to check for non-empty tags.hasKey in interface Taggedkey - the keykeyTagged.hasTag(String)public final java.util.Map<java.lang.String,java.lang.String> getKeys()
Taggedpublic final void setKeys(java.util.Map<java.lang.String,java.lang.String> keys)
Taggedpublic final void remove(java.lang.String key)
Taggedpublic final boolean hasKeys()
Taggedpublic final java.util.Collection<java.lang.String> keySet()
Taggedpublic int getNumKeys()
TaggedgetNumKeys in interface Taggedpublic java.util.Map<java.lang.String,java.lang.String> getTags()
public Changeset getChangeset()
public void setChangeset(Changeset changeset)
changeset - the changeset for this history primitivepublic void setTags(java.util.Map<java.lang.String,java.lang.String> tags)
tags is null.tags - the tags. May be null.public java.lang.String getName()
name or null, if this tag is not present.public abstract java.lang.String getDisplayName(HistoryNameFormatter formatter)
formatterformatter - The formatter used to generate a display namepublic java.lang.String getLocalName()
protected void fillPrimitiveCommonData(PrimitiveData data)
data - primitive data to fillpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object