Changeset 13677 in josm
- Timestamp:
- 2018-04-25T00:53:02+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
r11747 r13677 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import java.util.Arrays;5 4 import java.util.Objects; 6 5 import java.util.Optional; … … 9 8 10 9 /** 11 * A linkage class that can be used by an relation to keep a list of 12 * members. Since membership may be qualified by a "role", a simple 13 * list is not sufficient. 14 * 10 * A linkage class that can be used by an relation to keep a list of members. 11 * Since membership may be qualified by a "role", a simple list is not sufficient. 12 * @since 343 15 13 */ 16 public class RelationMember implements PrimitiveId{14 public class RelationMember implements IRelationMember { 17 15 18 16 /** … … 26 24 private final OsmPrimitive member; 27 25 28 /** 29 * Returns the role of this relation member. 30 * @return Role name or "". Never returns null 31 * @since 1930 32 */ 26 @Override 33 27 public String getRole() { 34 28 return role; 35 29 } 36 30 37 /** 38 * Determines if this relation member has a role. 39 * @return True if role is set 40 * @since 1930 41 */ 42 public boolean hasRole() { 43 return !"".equals(role); 44 } 45 46 /** 47 * Determines if this relation member's role is in the given list. 48 * @param roles The roles to look after 49 * @return True if role is in the given list 50 * @since 6305 51 */ 52 public boolean hasRole(String... roles) { 53 return Arrays.asList(roles).contains(role); 54 } 55 56 /** 57 * Determines if this relation member is a relation. 58 * @return True if member is relation 59 * @since 1937 60 */ 31 @Override 61 32 public boolean isRelation() { 62 33 return member instanceof Relation; 63 34 } 64 35 65 /** 66 * Determines if this relation member is a way. 67 * @return True if member is way 68 * @since 1937 69 */ 36 @Override 70 37 public boolean isWay() { 71 38 return member instanceof Way; … … 73 40 74 41 /** 75 * 42 * Returns type of member for icon display. 76 43 * @return type of member for icon display 77 44 * @since 3844 … … 81 48 } 82 49 83 /** 84 * Determines if this relation member is a node. 85 * @return True if member is node 86 * @since 1937 87 */ 50 @Override 88 51 public boolean isNode() { 89 52 return member instanceof Node; … … 186 149 187 150 /** 188 * PrimitiveId implementation. Returns the same value as getMember Type().getUniqueId()151 * PrimitiveId implementation. Returns the same value as getMember().getUniqueId() 189 152 */ 190 153 @Override … … 193 156 } 194 157 158 /** 159 * PrimitiveId implementation. Returns the same value as getMember().isNew() 160 */ 195 161 @Override 196 162 public boolean isNew() { -
trunk/src/org/openstreetmap/josm/data/osm/RelationMemberData.java
r12866 r13677 9 9 /** 10 10 * This is the data (role, type and id) that is stored in the database for a given relation member. 11 * @since 2284 11 12 */ 12 public class RelationMemberData implements PrimitiveId, Serializable {13 public class RelationMemberData implements IRelationMember, Serializable { 13 14 14 15 private static final long serialVersionUID = 381392198209333319L; … … 49 50 } 50 51 51 /** 52 * Get member role. 53 * @return member role 54 */ 52 @Override 55 53 public String getRole() { 56 54 return role; … … 65 63 } 66 64 67 /** 68 * Determines if this member has a role. 69 * @return {@code true} if this member has a role 70 */ 71 public boolean hasRole() { 72 return !"".equals(role); 65 @Override 66 public boolean isNode() { 67 return OsmPrimitiveType.NODE == memberType; 68 } 69 70 @Override 71 public boolean isWay() { 72 return OsmPrimitiveType.WAY == memberType; 73 } 74 75 @Override 76 public boolean isRelation() { 77 return OsmPrimitiveType.RELATION == memberType; 73 78 } 74 79
Note:
See TracChangeset
for help on using the changeset viewer.