Changeset 3556 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-09-23T09:41:18+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r3355 r3556 7 7 import java.io.PushbackReader; 8 8 import java.io.StringReader; 9 import java.text.Normalizer; 9 10 import java.util.regex.Matcher; 10 11 import java.util.regex.Pattern; … … 235 236 String v2 = caseSensitive ? value : value.toLowerCase(); 236 237 237 // is not Java 1.5 238 //v1 = java.text.Normalizer.normalize(v1, java.text.Normalizer.Form.NFC); 239 //v2 = java.text.Normalizer.normalize(v2, java.text.Normalizer.Form.NFC); 238 v1 = Normalizer.normalize(v1, Normalizer.Form.NFC); 239 v2 = Normalizer.normalize(v2, Normalizer.Form.NFC); 240 240 return v1.indexOf(v2) != -1; 241 241 } … … 260 260 261 261 public ExactKeyValue(boolean regexp, String key, String value) throws ParseError { 262 if ( key == "")262 if ("".equals(key)) 263 263 throw new ParseError(tr("Key cannot be empty when tag operator is used. Sample use: key=value")); 264 264 this.key = key; … … 380 380 381 381 public Any(String s, boolean regexSearch, boolean caseSensitive) throws ParseError { 382 s = Normalizer.normalize(s, Normalizer.Form.NFC); 382 383 this.caseSensitive = caseSensitive; 383 384 if (regexSearch) { … … 400 401 401 402 @Override public boolean match(OsmPrimitive osm) { 402 if (!osm.hasKeys() )403 if (!osm.hasKeys() && osm.getUser() == null) 403 404 return search.equals(""); 404 405 405 // is not Java 1.5406 //search = java.text.Normalizer.normalize(search, java.text.Normalizer.Form.NFC);407 406 for (String key: osm.keySet()) { 408 407 String value = osm.get(key); 409 408 if (searchRegex != null) { 410 409 411 // is not Java 1.5 412 //value = java.text.Normalizer.normalize(value, java.text.Normalizer.Form.NFC); 410 value = Normalizer.normalize(value, Normalizer.Form.NFC); 413 411 414 412 Matcher keyMatcher = searchRegex.matcher(key); … … 426 424 } 427 425 428 // is not Java 1.5 429 //value = java.text.Normalizer.normalize(value, java.text.Normalizer.Form.NFC); 426 value = Normalizer.normalize(value, Normalizer.Form.NFC); 430 427 431 428 if (key.indexOf(search) != -1 || value.indexOf(search) != -1) … … 434 431 } 435 432 if (osm.getUser() != null) { 436 String name = osm.getUser().getName();437 // is not Java 1.5438 //String name = java.text.Normalizer.normalize(name, java.text.Normalizer.Form.NFC);439 if (!caseSensitive) {440 name = name.toLowerCase();441 }442 if (name.indexOf(search) != -1)443 return true;433 for (String name : osm.getUser().getNames()) { 434 name = Normalizer.normalize(name, Normalizer.Form.NFC); 435 if (!caseSensitive) { 436 name = name.toLowerCase(); 437 } 438 if (name.indexOf(search) != -1) 439 return true; 440 } 444 441 } 445 442 return false;
Note:
See TracChangeset
for help on using the changeset viewer.