All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.javagimmicks.collections.event.SortedMapEvent Maven / Gradle / Ivy

package net.sf.javagimmicks.collections.event;

import net.sf.javagimmicks.lang.LangUtils;

public class SortedMapEvent
{
   public static enum Type {ADDED, UPDATED, REMOVED};
   
   protected final ObservableEventSortedMap _source;
   
   protected final Type _type;
   protected final K _key;
   protected final V _value;
   protected final V _newValue;
   
   public SortedMapEvent(ObservableEventSortedMap source, Type type, K key, V value, V newValue)
   {
      _source = source;
      _type = type;
      _key = key;
      _value = value;
      _newValue = newValue;
   }

   public SortedMapEvent(ObservableEventSortedMap source, Type type, K key, V value)
   {
      this(source, type, key, value, null);
   }
   
   public ObservableEventSortedMap getSource()
   {
      return _source;
   }

   public Type getType()
   {
      return _type;
   }

   public K getKey()
   {
      return _key;
   }

   public V getValue()
   {
      return _value;
   }

   public V getNewValue()
   {
      return _newValue;
   }
   
   public boolean equals(Object o)
   {
      if(!(o instanceof SortedMapEvent))
      {
         return false;
      }
      
      SortedMapEvent other = (SortedMapEvent)o;
      return
         _source == other._source &&
         _type == other._type &&
         LangUtils.equalsNullSafe(_key, other._key) &&
         LangUtils.equalsNullSafe(_value, other._value) &&
         LangUtils.equalsNullSafe(_newValue, other._newValue);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy