Class HistoryRelation
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive
-
- org.openstreetmap.josm.data.osm.history.HistoryRelation
-
- All Implemented Interfaces:
java.lang.Comparable<HistoryOsmPrimitive>,PrimitiveId,Tagged
public class HistoryRelation extends HistoryOsmPrimitive
Represents an immutable OSM relation in the context of a historical view on OSM data.- Since:
- 1670
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<RelationMemberData>members-
Fields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH
-
-
Constructor Summary
Constructors Constructor Description HistoryRelation(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp)constructorHistoryRelation(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, boolean checkHistoricParams)constructorHistoryRelation(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, java.util.List<RelationMemberData> members)constructorHistoryRelation(Relation r)Constructs a newHistoryRelationfrom an existingRelation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMember(RelationMemberData member)adds a member to the list of membersRelationDatafillPrimitiveData(RelationData data)Fills the relation attributes with values from this history.java.lang.StringgetDisplayName(HistoryNameFormatter formatter)Replies the display name of a primitive formatted byformatterjava.util.List<RelationMemberData>getMembers()replies an immutable list of members of this relationintgetNumMembers()replies the number of membersRelationMemberDatagetRelationMember(int idx)replies the idx-th memberOsmPrimitiveTypegetType()replies the type, i.e.-
Methods inherited from class org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive
compareTo, ensurePositiveLong, equals, fillPrimitiveCommonData, forOsmPrimitive, get, getChangeset, getChangesetId, getId, getInstant, getKeys, getLocalName, getName, getNumKeys, getPrimitiveId, getTags, getUniqueId, getUser, getVersion, hashCode, hasKey, hasKeys, isNew, isVisible, keySet, matches, matches, put, remove, removeAll, setChangeset, setKeys, setTags, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.osm.Tagged
hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, keys, put, putAll, visitKeys
-
-
-
-
Field Detail
-
members
private final java.util.List<RelationMemberData> members
-
-
Constructor Detail
-
HistoryRelation
public HistoryRelation(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp)
constructor- Parameters:
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)- Throws:
java.lang.IllegalArgumentException- if preconditions are violated
-
HistoryRelation
public HistoryRelation(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, boolean checkHistoricParams)
constructor- Parameters:
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 ifcheckHistoricParamsis true)timestamp- the timestamp (!= null required ifcheckHistoricParamsis true)checkHistoricParams- If true, checks values ofchangesetIdandtimestamp- Throws:
java.lang.IllegalArgumentException- if preconditions are violated- Since:
- 5440
-
HistoryRelation
public HistoryRelation(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, java.util.List<RelationMemberData> members)
constructor- Parameters:
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)members- list of members for this relation- Throws:
java.lang.IllegalArgumentException- if preconditions are violated
-
HistoryRelation
public HistoryRelation(Relation r)
Constructs a newHistoryRelationfrom an existingRelation.- Parameters:
r- the relation
-
-
Method Detail
-
getMembers
public java.util.List<RelationMemberData> getMembers()
replies an immutable list of members of this relation- Returns:
- an immutable list of members of this relation
-
getNumMembers
public int getNumMembers()
replies the number of members- Returns:
- the number of members
-
getRelationMember
public RelationMemberData getRelationMember(int idx)
replies the idx-th member- Parameters:
idx- the index- Returns:
- the idx-th member
- Throws:
java.lang.IndexOutOfBoundsException- if idx is out of bounds
-
getType
public OsmPrimitiveType getType()
replies the type, i.e.OsmPrimitiveType.RELATION
-
addMember
public void addMember(RelationMemberData member)
adds a member to the list of members- Parameters:
member- the member (must not be null)- Throws:
java.lang.IllegalArgumentException- if member is null
-
getDisplayName
public java.lang.String getDisplayName(HistoryNameFormatter formatter)
Description copied from class:HistoryOsmPrimitiveReplies the display name of a primitive formatted byformatter- Specified by:
getDisplayNamein classHistoryOsmPrimitive- Parameters:
formatter- The formatter used to generate a display name- Returns:
- the display name
-
fillPrimitiveData
public RelationData fillPrimitiveData(RelationData data)
Fills the relation attributes with values from this history.- Parameters:
data- relation data to fill- Returns:
- filled relation data
- Since:
- 11878
-
-