Changeset 8896 in josm for trunk


Ignore:
Timestamp:
2015-10-18T13:31:21+02:00 (9 years ago)
Author:
simon04
Message:

see #10465 - SearchAction: drop isRole since role does the same

Location:
trunk/src/org/openstreetmap/josm/actions/search
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r8884 r8896  
    420420                .addKeyword("parent <i>expr</i>", "parent ", tr("all parents of objects matching the expression"), "parent bus_stop")
    421421                .addKeyword("hasRole:<i>stop</i>", "hasRole:", tr("relation containing a member of role <i>stop</i>"))
    422                 .addKeyword("isRole:<i>stop</i>", "isRole:", tr("objects being part of a relation as role <i>stop</i>"))
     422                .addKeyword("role:<i>stop</i>", "role:", tr("objects being part of a relation as role <i>stop</i>"))
    423423                .addKeyword("nth:<i>7</i>", "nth:",
    424424                        tr("n-th member of relation and/or n-th node of way"), "nth:5 (child type:relation)", "nth:-1")
  • trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java

    r8884 r8896  
    159159                    case "hasRole":
    160160                        return new HasRole(tokenizer);
    161                     case "isRole":
    162                         return new IsRole(tokenizer);
    163161                    case "timestamp":
    164162                        // add leading/trailing space in order to get expected split (e.g. "a--" => {"a", ""})
     
    11441142        public boolean match(OsmPrimitive osm) {
    11451143            return osm instanceof Relation && ((Relation) osm).getMemberRoles().contains(role);
    1146         }
    1147     }
    1148 
    1149     /**
    1150      * Matches object which are part of a relation with the given role
    1151      */
    1152     private static class IsRole extends Match {
    1153         private final String role;
    1154 
    1155         IsRole(PushbackTokenizer tokenizer) {
    1156             role = tokenizer.readTextOrNumber();
    1157         }
    1158 
    1159         @Override
    1160         public boolean match(final OsmPrimitive osm) {
    1161             for (final OsmPrimitive ref : osm.getReferrers()) {
    1162                 if (ref instanceof Relation && Utils.exists(((Relation) ref).getMembers(), new Predicate<RelationMember>() {
    1163                     @Override
    1164                     public boolean evaluate(RelationMember object) {
    1165                         return osm.equals(object.getMember()) && role.equals(object.getRole());
    1166                     }
    1167                 })) {
    1168                     return true;
    1169                 }
    1170             }
    1171             return false;
    11721144        }
    11731145    }
Note: See TracChangeset for help on using the changeset viewer.