Changeset 8740 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2015-09-09T13:03:32+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r8735 r8740 27 27 public abstract class AbstractPrimitive implements IPrimitive { 28 28 29 /** 30 * This is a visitor that can be used to loop over the keys/values of this primitive. 31 * 32 * @author Michael Zangl 33 * @since 8740 34 */ 35 public interface KeyValueVisitor { 36 37 /** 38 * This method gets called for every tag received. 39 * 40 * @param key The key 41 * @param value The value 42 */ 43 void visitKeyValue(String key, String value); 44 } 45 29 46 private static final AtomicLong idCounter = new AtomicLong(0); 30 47 … … 477 494 * @return tags of this primitive. Changes made in returned map are not mapped 478 495 * back to the primitive, use setKeys() to modify the keys 496 * @see #visitKeys(KeyValueVisitor) 479 497 */ 480 498 @Override … … 489 507 } 490 508 return result; 509 } 510 511 /** 512 * Calls the visitor for every key/value pair of this primitive. 513 * 514 * @param visitor The visitor to call. 515 * @see #getKeys() 516 * @since 8740 517 */ 518 public void visitKeys(KeyValueVisitor visitor) { 519 final String[] keys = this.keys; 520 if (keys != null) { 521 for (int i = 0; i < keys.length; i += 2) { 522 visitor.visitKeyValue(keys[i], keys[i + 1]); 523 } 524 } 491 525 } 492 526
Note:
See TracChangeset
for help on using the changeset viewer.