Ignore:
Timestamp:
2009-10-15T22:20:19+02:00 (16 years ago)
Author:
Gubaer
Message:

Replaced OsmPrimtive.user by setters/getters

File:
1 edited

Legend:

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

    r2273 r2291  
    230230
    231231            switch (mode) {
    232             case NONE:
    233                 return false;
    234             case MISSING_KEY:
    235                 return osm.get(key) == null;
    236             case ANY:
    237                 return true;
    238             case ANY_VALUE:
    239                 return osm.get(key) != null;
    240             case ANY_KEY:
    241                 for (String v:osm.getKeys().values()) {
    242                     if (v.equals(value))
    243                         return true;
    244                 }
    245                 return false;
    246             case EXACT:
    247                 return value.equals(osm.get(key));
    248             case ANY_KEY_REGEXP:
    249                 for (String v:osm.getKeys().values()) {
    250                     if (valuePattern.matcher(v).matches())
    251                         return true;
    252                 }
    253                 return false;
    254             case ANY_VALUE_REGEXP:
    255             case EXACT_REGEXP:
    256                 for (Entry<String, String> entry:osm.entrySet()) {
    257                     if (keyPattern.matcher(entry.getKey()).matches()) {
    258                         if (mode == Mode.ANY_VALUE_REGEXP
    259                                 || valuePattern.matcher(entry.getValue()).matches())
     232                case NONE:
     233                    return false;
     234                case MISSING_KEY:
     235                    return osm.get(key) == null;
     236                case ANY:
     237                    return true;
     238                case ANY_VALUE:
     239                    return osm.get(key) != null;
     240                case ANY_KEY:
     241                    for (String v:osm.getKeys().values()) {
     242                        if (v.equals(value))
    260243                            return true;
    261244                    }
    262                 }
    263                 return false;
    264             case MISSING_KEY_REGEXP:
    265                 for (String k:osm.keySet()) {
    266                     if (keyPattern.matcher(k).matches())
    267                         return false;
    268                 }
    269                 return true;
     245                    return false;
     246                case EXACT:
     247                    return value.equals(osm.get(key));
     248                case ANY_KEY_REGEXP:
     249                    for (String v:osm.getKeys().values()) {
     250                        if (valuePattern.matcher(v).matches())
     251                            return true;
     252                    }
     253                    return false;
     254                case ANY_VALUE_REGEXP:
     255                case EXACT_REGEXP:
     256                    for (Entry<String, String> entry:osm.entrySet()) {
     257                        if (keyPattern.matcher(entry.getKey()).matches()) {
     258                            if (mode == Mode.ANY_VALUE_REGEXP
     259                                    || valuePattern.matcher(entry.getValue()).matches())
     260                                return true;
     261                        }
     262                    }
     263                    return false;
     264                case MISSING_KEY_REGEXP:
     265                    for (String k:osm.keySet()) {
     266                        if (keyPattern.matcher(k).matches())
     267                            return false;
     268                    }
     269                    return true;
    270270            }
    271271            throw new AssertionError("Missed state");
     
    331331                }
    332332            }
    333             if (osm.user != null) {
    334                 String name = osm.user.getName();
     333            if (osm.getUser() != null) {
     334                String name = osm.getUser().getName();
    335335                // is not Java 1.5
    336336                //String name = java.text.Normalizer.normalize(name, java.text.Normalizer.Form.NFC);
     
    377377        }
    378378        @Override public boolean match(OsmPrimitive osm) {
    379             if (osm.user == null && user == null) return true;
    380             if (osm.user == null) return false;
    381             return osm.user.equals(user);
     379            if (osm.getUser() == null && user == null) return true;
     380            if (osm.getUser() == null) return false;
     381            return osm.getUser().equals(user);
    382382        }
    383383        @Override public String toString() {
Note: See TracChangeset for help on using the changeset viewer.