| Revision 4514,
1.4 KB
checked in by Don-vip, 7 months ago
(diff) |
|
Test: change SVN property svn:mime-type=text/plain to text/x-java to see if it brings back syntax coloring in Trac
|
-
Property svn:eol-style set to
native
-
Property svn:mime-type set to
text/x-java
|
| Line | |
|---|
| 1 | // License: GPL. For details, see LICENSE file. |
|---|
| 2 | package org.openstreetmap.josm.data.osm; |
|---|
| 3 | |
|---|
| 4 | public class RelationMemberData implements PrimitiveId { |
|---|
| 5 | |
|---|
| 6 | private final String role; |
|---|
| 7 | private final long memberId; |
|---|
| 8 | private final OsmPrimitiveType memberType; |
|---|
| 9 | |
|---|
| 10 | public RelationMemberData(String role, OsmPrimitiveType type, long id) { |
|---|
| 11 | this.role = role == null?"":role; |
|---|
| 12 | this.memberType = type; |
|---|
| 13 | this.memberId = id; |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | public RelationMemberData(String role, PrimitiveId primitive) { |
|---|
| 17 | this(role, primitive.getType(), primitive.getUniqueId()); |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | public long getMemberId() { |
|---|
| 21 | return memberId; |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | public String getRole() { |
|---|
| 25 | return role; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | public OsmPrimitiveType getMemberType() { |
|---|
| 29 | return memberType; |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | public boolean hasRole() { |
|---|
| 33 | return !"".equals(role); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | @Override |
|---|
| 37 | public String toString() { |
|---|
| 38 | return (memberType != null ? memberType.getAPIName() : "undefined") + " " + memberId; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | /** |
|---|
| 42 | * PrimitiveId implementation. Returns the same value as {@link #getMemberType()} |
|---|
| 43 | */ |
|---|
| 44 | @Override |
|---|
| 45 | public OsmPrimitiveType getType() { |
|---|
| 46 | return memberType; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | /** |
|---|
| 50 | * PrimitiveId implementation. Returns the same value as {@link #getMemberId()()} |
|---|
| 51 | */ |
|---|
| 52 | @Override |
|---|
| 53 | public long getUniqueId() { |
|---|
| 54 | return memberId; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | @Override |
|---|
| 58 | public boolean isNew() { |
|---|
| 59 | return memberId <= 0; |
|---|
| 60 | } |
|---|
| 61 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.