1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.osm;
|
---|
3 |
|
---|
4 | import java.util.Set;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.data.DataSource;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * The event that is fired when the data source list is changed.
|
---|
10 | *
|
---|
11 | * @author Taylor Smock
|
---|
12 | * @since 15609
|
---|
13 | */
|
---|
14 | public interface DataSourceChangeEvent {
|
---|
15 | /**
|
---|
16 | * Gets the previous data source list
|
---|
17 | * <p>
|
---|
18 | * This collection cannot be modified and will not change.
|
---|
19 | *
|
---|
20 | * @return The old data source list
|
---|
21 | */
|
---|
22 | Set<DataSource> getOldDataSources();
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Gets the new data sources. New data sources are added to the end of the
|
---|
26 | * collection.
|
---|
27 | * <p>
|
---|
28 | * This collection cannot be modified and will not change.
|
---|
29 | *
|
---|
30 | * @return The new data sources
|
---|
31 | */
|
---|
32 | Set<DataSource> getDataSources();
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Gets the Data Sources that have been removed from the selection.
|
---|
36 | * <p>
|
---|
37 | * Those are the primitives contained in {@link #getOldDataSources()} but not in
|
---|
38 | * {@link #getDataSources()}
|
---|
39 | * <p>
|
---|
40 | * This collection cannot be modified and will not change.
|
---|
41 | *
|
---|
42 | * @return The DataSources that were removed
|
---|
43 | */
|
---|
44 | Set<DataSource> getRemoved();
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * Gets the data sources that have been added to the selection.
|
---|
48 | * <p>
|
---|
49 | * Those are the data sources contained in {@link #getDataSources()} but not in
|
---|
50 | * {@link #getOldDataSources()}
|
---|
51 | * <p>
|
---|
52 | * This collection cannot be modified and will not change.
|
---|
53 | *
|
---|
54 | * @return The data sources that were added
|
---|
55 | */
|
---|
56 | Set<DataSource> getAdded();
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Gets the data set that triggered this selection event.
|
---|
60 | *
|
---|
61 | * @return The data set.
|
---|
62 | */
|
---|
63 | DataSet getSource();
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Test if this event did not change anything.
|
---|
67 | * <p>
|
---|
68 | * This will return <code>false</code> for all events that are sent to
|
---|
69 | * listeners, so you don't need to test it.
|
---|
70 | *
|
---|
71 | * @return <code>true</code> if this did not change the selection.
|
---|
72 | */
|
---|
73 | default boolean isNop() {
|
---|
74 | return getAdded().isEmpty() && getRemoved().isEmpty();
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|