source: josm/trunk/src/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEvent.java@ 11928

Last change on this file since 11928 was 11928, checked in by Don-vip, 7 years ago

improve unit tests, javadoc

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm.event;
3
4import java.util.ArrayList;
5import java.util.Collection;
6import java.util.Collections;
7import java.util.List;
8
9import org.openstreetmap.josm.data.osm.DataSet;
10import org.openstreetmap.josm.data.osm.OsmPrimitive;
11
12public class PrimitivesAddedEvent extends AbstractDatasetChangedEvent {
13
14 private final List<? extends OsmPrimitive> primitives;
15 private final boolean wasIncomplete;
16
17 /**
18 * Constructs a new {@code PrimitivesAddedEvent}.
19 * @param dataSet the dataset from which the event comes from
20 * @param primitives the list of primitives affected by the change
21 * @param wasIncomplete {@code true} if primitive was in dataset before (so it's not really added), but it was incomplete
22 */
23 public PrimitivesAddedEvent(DataSet dataSet, Collection<? extends OsmPrimitive> primitives, boolean wasIncomplete) {
24 super(dataSet);
25 this.primitives = Collections.unmodifiableList(new ArrayList<>(primitives));
26 this.wasIncomplete = wasIncomplete;
27 }
28
29 @Override
30 public void fire(DataSetListener listener) {
31 listener.primitivesAdded(this);
32 }
33
34 @Override
35 public List<? extends OsmPrimitive> getPrimitives() {
36 return primitives;
37 }
38
39 /**
40 * Determines if primitive was in dataset before (so it's not really added), but it was incomplete
41 * @return {@code true} if primitive was in dataset before (so it's not really added), but it was incomplete
42 */
43 public boolean wasIncomplete() {
44 return wasIncomplete;
45 }
46
47 @Override
48 public DatasetEventType getType() {
49 return DatasetEventType.PRIMITIVES_ADDED;
50 }
51
52}
Note: See TracBrowser for help on using the repository browser.