Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Tagged.java
r13414 r13430 76 76 /** 77 77 * Replies true if there is a tag with key <code>key</code>. 78 * The value could however be empty. See {@link #hasTag(String)} to check for non-empty tags. 78 79 * 79 80 * @param key the key 80 81 * @return true, if there is a tag with key <code>key</code> 82 * @see #hasTag(String) 81 83 * @since 11608 82 84 */ 83 85 default boolean hasKey(String key) { 84 86 return get(key) != null; 87 } 88 89 /** 90 * Replies true if there is a non-empty tag with key <code>key</code>. 91 * 92 * @param key the key 93 * @return true, if there is a non-empty tag with key <code>key</code> 94 * @see Tagged#hasKey(String) 95 * @since 13430 96 */ 97 default boolean hasTag(String key) { 98 String v = get(key); 99 return v != null && !v.isEmpty(); 85 100 } 86 101 -
trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
r13317 r13430 836 836 return false; 837 837 case MISSING_KEY: 838 return osm.get(key) == null;838 return !osm.hasTag(key); 839 839 case ANY: 840 840 return true; 841 841 case ANY_VALUE: 842 return osm. get(key) != null;842 return osm.hasTag(key); 843 843 case ANY_KEY: 844 844 for (String v:osm.getKeys().values()) { -
trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
r13325 r13430 496 496 497 497 /** 498 * Test empty values. 499 * @throws SearchParseError never 500 */ 501 @Test 502 public void testEmptyValues15943() throws SearchParseError { 503 Match matcher = SearchCompiler.compile("access="); 504 assertTrue(matcher.match(new Tag("access", null))); 505 assertTrue(matcher.match(new Tag("access", ""))); 506 assertFalse(matcher.match(new Tag("access", "private"))); 507 } 508 509 /** 498 510 * Unit test of {@link SearchCompiler.ExactKeyValue.Mode} enum. 499 511 */ … … 562 574 } 563 575 564 565 576 /** 566 577 * Ensures that correct presets are stored in the {@link org.openstreetmap.josm.data.osm.search.SearchCompiler.Preset}
Note:
See TracChangeset
for help on using the changeset viewer.