001    package edu.nrao.sss.model.resource;
002    
003    import java.util.ArrayList;
004    import java.util.Collection;
005    import java.util.EventObject;
006    
007    /**
008     * An event that indicates a collection of {@link CorrelatorBaseband} has
009     * been changed.  Note that this event says nothing about what may or
010     * may not have changed about the basebands within the collection.  It
011     * is concerned with the collection itself and whether any basebands
012     * have left or joined the collection of interest.
013     * <p>
014     * <b>Version Info:</b>
015     * <table style="margin-left:2em">
016     *   <tr><td>$Revision: 1107 $</td></tr>
017     *   <tr><td>$Date: 2008-02-15 16:50:27 -0700 (Fri, 15 Feb 2008) $</td></tr>
018     *   <tr><td>$Author: dharland $ (last person to modify)</td></tr>
019     * </table></p>
020     * 
021     * @author David M. Harland
022     * @since 2008-02-14
023     */
024    public class BasebandCollectionEvent
025      extends EventObject
026    {
027      private static final long serialVersionUID = 1L;
028      
029      private Collection<CorrelatorBaseband> added;
030      private Collection<CorrelatorBaseband> removed;
031      
032      /** Creates a new event. */
033      public BasebandCollectionEvent(Object source,
034                                     Collection<CorrelatorBaseband> basebandsAdded,
035                                     Collection<CorrelatorBaseband> basebandsRemoved)
036      {
037        super(source);
038        
039        added   = new ArrayList<CorrelatorBaseband>(basebandsAdded);
040        removed = new ArrayList<CorrelatorBaseband>(basebandsRemoved);
041      }
042      
043      /**
044       * Returns the basebands that were added as a result of this event.
045       * The returned collection is a copy of the one held internally
046       * by this event.  It may be empty if no basebands were added,
047       * but it will never be <i>null</i>.
048       * 
049       * @return the basebands that were added as a result of this event.
050       */
051      public Collection<CorrelatorBaseband> getBasebandsAdded()
052      {
053        return new ArrayList<CorrelatorBaseband>(added);
054      }
055    
056      /**
057       * Returns the basebands that were removed as a result of this event.
058       * The returned collection is a copy of the one held internally
059       * by this event.  It may be empty if no basebands were removed,
060       * but it will never be <i>null</i>.
061       * 
062       * @return the basebands that were moved as a result of this event.
063       */
064      public Collection<CorrelatorBaseband> getBasebandsRemoved()
065      {
066        return new ArrayList<CorrelatorBaseband>(removed);
067      }
068    }