Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
r14303 r14518 123 123 if (primitives == null || primitives.isEmpty()) return tags; 124 124 // initialize with the first 125 //126 125 tags.add(TagCollection.from(primitives.iterator().next())); 127 126 … … 132 131 continue; 133 132 } 134 tags.add(tags.intersect(TagCollection.from(primitive))); 133 tags = tags.intersect(TagCollection.from(primitive)); 134 if (tags.isEmpty()) 135 break; 135 136 } 136 137 return tags; -
trunk/test/unit/org/openstreetmap/josm/data/osm/TagCollectionTest.java
r14302 r14518 706 706 assertEquals("0", f.getSummedValues("k")); 707 707 } 708 709 /** 710 * Test method for {@link TagCollection#commonToAllPrimitives(Collection)}. 711 */ 712 @Test 713 public void testCommonToAllPrimitives() { 714 Tagged t1 = new Node(); 715 t1.put("k1", "10"); 716 t1.put("k2", "20"); 717 Tagged t2 = new Node(); 718 t2.put("k2", "20"); 719 TagCollection c = TagCollection.commonToAllPrimitives(Arrays.asList(t1, t2)); 720 assertEquals(1, c.size()); 721 assertFalse(c.hasValuesFor("k1")); 722 assertTrue(c.hasValuesFor("k2")); 723 assertEquals(1, c.getValues("k2").size()); 724 assertEquals("20", c.getValues("k2").iterator().next()); 725 } 708 726 }
Note:
See TracChangeset
for help on using the changeset viewer.