1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.osm.history;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Represents a relation member in the the context of a historical view on
|
---|
10 | * OSM data.
|
---|
11 | *
|
---|
12 | */
|
---|
13 | public class RelationMember {
|
---|
14 |
|
---|
15 | private String role;
|
---|
16 | private OsmPrimitiveType primitiveType;
|
---|
17 | private long primitiveId;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | *
|
---|
21 | * @param role the role
|
---|
22 | * @param primitiveType the type (must not be null)
|
---|
23 | * @param primitiveId the id (>0 required)
|
---|
24 | *
|
---|
25 | * @exception IllegalArgumentException thrown, if primitiveType is null
|
---|
26 | * @exception IllegalArgumentException thrown, if primitiveId <= 0
|
---|
27 | */
|
---|
28 | public RelationMember(String role, OsmPrimitiveType primitiveType, long primitiveId) {
|
---|
29 | this.role = (role == null ? "" : role);
|
---|
30 | if (primitiveType == null)
|
---|
31 | throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "primitiveType"));
|
---|
32 | this.primitiveType = primitiveType;
|
---|
33 | if (primitiveId <=0)
|
---|
34 | throw new IllegalArgumentException(tr("Parameter ''{0}'' > 0 expected. Got ''{1}''.", "primitiveId", primitiveId));
|
---|
35 | this.primitiveId = primitiveId;
|
---|
36 | }
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * replies the member role
|
---|
40 | * @return the member role
|
---|
41 | */
|
---|
42 | public String getRole() {
|
---|
43 | return role;
|
---|
44 | }
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * replies the type of the referenced OSM primitive
|
---|
48 | *
|
---|
49 | * @return the type of the referenced OSM primitive
|
---|
50 | */
|
---|
51 | public OsmPrimitiveType getPrimitiveType() {
|
---|
52 | return primitiveType;
|
---|
53 | }
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * replies the id of the referenced OSM primitive
|
---|
57 | *
|
---|
58 | * @return the id of the referenced OSM primitive
|
---|
59 | */
|
---|
60 | public long getPrimitiveId() {
|
---|
61 | return primitiveId;
|
---|
62 | }
|
---|
63 | }
|
---|