Changeset 11989 in josm for trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Roles.java
- Timestamp:
- 2017-04-23T22:55:45+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Roles.java
r10001 r11989 29 29 /** Role name used in a relation */ 30 30 public String key; // NOSONAR 31 /** Is the role name a regular expression */ 32 public boolean regexp; // NOSONAR 31 33 /** The text to display */ 32 34 public String text; // NOSONAR … … 37 39 /** An expression (cf. search dialog) for objects of this role */ 38 40 public SearchCompiler.Match memberExpression; // NOSONAR 39 41 /** Is this role required at least once in the relation? */ 40 42 public boolean required; // NOSONAR 43 /** How often must the element appear */ 41 44 private long count; 42 45 … … 50 53 } else if (!"optional".equals(str)) 51 54 throw new SAXException(tr("Unknown requisite: {0}", str)); 55 } 56 57 public void setRegexp(String str) throws SAXException { 58 if ("true".equals(str)) { 59 regexp = true; 60 } else if (!"false".equals(str)) 61 throw new SAXException(tr("Unknown regexp value: {0}", str)); 52 62 } 53 63 … … 83 93 else 84 94 return c != 0 ? c : 1; 95 } 96 97 /** 98 * Check if the given role matches this class (required to check regexp role types) 99 * @param role role to check 100 * @return <code>true</code> if role matches 101 * @since 11989 102 */ 103 public boolean isRole(String role) { 104 if (regexp && role != null) { // pass null through, it will anyway fail 105 106 return role.matches(this.key); 107 } 108 return this.key.equals(role); 85 109 } 86 110
Note:
See TracChangeset
for help on using the changeset viewer.