001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.osm;
003
004import java.util.Set;
005
006import org.openstreetmap.josm.data.DataSource;
007import org.openstreetmap.josm.tools.CheckParameterUtil;
008
009/**
010 * The base class for data source change events
011 *
012 * @author Taylor Smock
013 * @since 15609
014 */
015public abstract class AbstractDataSourceChangeEvent implements DataSourceChangeEvent {
016
017    private final DataSet source;
018    private final Set<DataSource> old;
019
020    /**
021     * Create a Data Source change event
022     *
023     * @param source The DataSet that is originating the change
024     * @param old    The previous set of DataSources
025     */
026    protected AbstractDataSourceChangeEvent(DataSet source, Set<DataSource> old) {
027        CheckParameterUtil.ensureParameterNotNull(source, "source");
028        CheckParameterUtil.ensureParameterNotNull(old, "old");
029        this.source = source;
030        this.old = old;
031    }
032
033    @Override
034    public Set<DataSource> getOldDataSources() {
035        return old;
036    }
037
038    @Override
039    public DataSet getSource() {
040        return source;
041    }
042}
043