001/*
002 * Copyright 2010-2015 Institut Pasteur.
003 * 
004 * This file is part of Icy.
005 * 
006 * Icy is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 * 
011 * Icy is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 * GNU General Public License for more details.
015 * 
016 * You should have received a copy of the GNU General Public License
017 * along with Icy. If not, see <http://www.gnu.org/licenses/>.
018 */
019package icy.math;
020
021import icy.common.CollapsibleEvent;
022
023/**
024 * @author stephane
025 */
026public class ScalerEvent implements CollapsibleEvent
027{
028    /**
029     * @deprecated
030     */
031    @Deprecated
032    public enum ScalerEventType
033    {
034        CHANGED
035    }
036
037    private final Scaler scaler;
038
039    /**
040     * @param scaler
041     */
042    public ScalerEvent(Scaler scaler)
043    {
044        super();
045
046        this.scaler = scaler;
047    }
048
049    /**
050     * @return the scaler
051     */
052    public Scaler getScaler()
053    {
054        return scaler;
055    }
056
057    /**
058     * @deprecated
059     */
060    @Deprecated
061    public ScalerEventType getType()
062    {
063        return ScalerEventType.CHANGED;
064    }
065
066    @Override
067    public boolean collapse(CollapsibleEvent event)
068    {
069        if (equals(event))
070        {
071            // nothing to do here
072            return true;
073        }
074
075        return false;
076    }
077
078    @Override
079    public int hashCode()
080    {
081        return scaler.hashCode();
082    }
083
084    @Override
085    public boolean equals(Object obj)
086    {
087        if (obj instanceof ScalerEvent)
088        {
089            final ScalerEvent e = (ScalerEvent) obj;
090
091            return (scaler == e.getScaler());
092        }
093
094        return super.equals(obj);
095    }
096}