Changeset 17876 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Tagged.java
r17662 r17876 6 6 import java.util.Map; 7 7 import java.util.Objects; 8 import java.util.stream.Collectors; 8 9 import java.util.stream.Stream; 9 10 … … 234 235 } 235 236 237 238 /** 239 * Returns a Tagged instance for the given tag collection 240 * @param tags the tag collection 241 * @return a Tagged instance for the given tag collection 242 */ 243 static Tagged ofTags(Collection<Tag> tags) { 244 return ofMap(tags.stream().collect(Collectors.toMap(Tag::getKey, Tag::getValue, (a, b) -> a))); 245 } 246 236 247 /** 237 248 * Returns a Tagged instance for the given tag map -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupport.java
r17875 r17876 4 4 import org.openstreetmap.josm.data.osm.OsmPrimitive; 5 5 import org.openstreetmap.josm.data.osm.Tag; 6 import org.openstreetmap.josm.data.osm.Tagged; 6 7 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 7 8 import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; … … 107 108 @Override 108 109 public boolean evaluateCondition(SearchCompiler.Match condition) { 109 throw new UnsupportedOperationException(); 110 Tagged tagged = Tagged.ofTags(changedTagsSupplier.get()); 111 return condition.match(tagged); 110 112 } 111 113 -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupportTest.java
r17611 r17876 37 37 void testTemplate() throws Exception { 38 38 ArrayList<Tag> tags = new ArrayList<>(Arrays.asList( 39 new Tag("route", "bus"), 39 40 new Tag("name", "xxx"), 40 41 new Tag("from", "Foo"), … … 46 47 TemplateEntry templateEntry = new TemplateParser("Bus {ref}: {from} -> {to}").parse(); 47 48 assertEquals("Bus 42: Foo -> Bar", templateEntry.getText(support)); 49 templateEntry = new TemplateParser("?{route=train 'Train'|route=bus 'Bus'|'X'} {ref}: {from} -> {to}").parse(); 50 assertEquals("Bus 42: Foo -> Bar", templateEntry.getText(support)); 48 51 } 49 52 }
Note:
See TracChangeset
for help on using the changeset viewer.