001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.plugins.eventbus.data;
003
004import java.util.EventObject;
005import java.util.Objects;
006
007/**
008 * Event fired when the syste of measurement changes.
009 */
010public class SoMChangedEvent extends EventObject {
011
012    private static final long serialVersionUID = 1L;
013
014    private final String oldSoM;
015    private final String newSoM;
016
017    /**
018     * Constructs a new {@code SoMChangedEvent}.
019     * @param source object on which the Event initially occurred
020     * @param oldSoM old system of measurement
021     * @param newSoM new system of measurement
022     */
023    public SoMChangedEvent(Object source, String oldSoM, String newSoM) {
024        super(source);
025        this.oldSoM = Objects.requireNonNull(oldSoM);
026        this.newSoM = Objects.requireNonNull(newSoM);
027    }
028
029    /**
030     * Returns the old system of measurement.
031     * @return the old system of measurement
032     */
033    public final String getOldSoM() {
034        return oldSoM;
035    }
036
037    /**
038     * Returns the new system of measurement.
039     * @return the new system of measurement
040     */
041    public final String getNewSoM() {
042        return newSoM;
043    }
044}