scolebourne    2003/09/07 03:33:33

  Modified:    collections/src/java/org/apache/commons/collections/observed
                        ObservedCollection.java ModificationEvent.java
                        ModificationHandler.java ObservedList.java
               collections/src/java/org/apache/commons/collections/observed/standard
                        StandardPostModificationEvent.java
                        StandardModificationHandler.java
                        StandardPreModificationEvent.java
                        StandardModificationEvent.java
               collections/src/test/org/apache/commons/collections/observed
                        ObservedTestHelper.java
  Log:
  Make the base collection available to listeners
  
  Revision  Changes    Path
  1.4       +3 -3      
jakarta-commons/collections/src/java/org/apache/commons/collections/observed/ObservedCollection.java
  
  Index: ObservedCollection.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/observed/ObservedCollection.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ObservedCollection.java   7 Sep 2003 00:51:31 -0000       1.3
  +++ ObservedCollection.java   7 Sep 2003 10:33:32 -0000       1.4
  @@ -193,7 +193,7 @@
               final Object listener) {
           super(coll);
           this.handler = createHandler(coll, listener);
  -        this.handler.init(this);
  +        this.handler.init(this, coll);
       }
   
       /**
  
  
  
  1.2       +29 -13    
jakarta-commons/collections/src/java/org/apache/commons/collections/observed/ModificationEvent.java
  
  Index: ModificationEvent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/observed/ModificationEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ModificationEvent.java    3 Sep 2003 23:54:26 -0000       1.1
  +++ ModificationEvent.java    7 Sep 2003 10:33:32 -0000       1.2
  @@ -73,7 +73,7 @@
   public class ModificationEvent extends EventObject {
   
       /** The source collection */
  -    protected final Collection collection;
  +    protected final ObservedCollection collection;
       /** The handler */
       protected final ModificationHandler handler;
       /** The event code */
  @@ -84,17 +84,17 @@
       /**
        * Constructor.
        * 
  -     * @param collection  the event source
  +     * @param obsCollection  the event source
        * @param handler  the handler
        * @param type  the event type
        */
       public ModificationEvent(
  -        final Collection collection,
  +        final ObservedCollection obsCollection,
           final ModificationHandler handler,
           final int type) {
   
  -        super(collection);
  -        this.collection = collection;
  +        super(obsCollection);
  +        this.collection = obsCollection;
           this.handler = handler;
           this.type = type;
       }
  @@ -104,16 +104,32 @@
       /**
        * Gets the collection the event is reporting on.
        * <p>
  -     * This method returns the <code>ObservedCollection</code> instance.
  -     * If this collection is wrapped, by a synchronized wrapper for example,
  -     * changing this collection will bypass the wrapper. For the synchronized
  -     * example, this will be OK so long as the event is processed in the same
  -     * thread and program stack as the modification was made in.
  +     * Using this collection will bypass any decorators that have been added
  +     * to the <code>ObservedCollection</code>. For example, if a synchronized
  +     * decorator was added it will not be called by changes to this collection.
  +     * <p>
  +     * For the synchronization case, you are normally OK however. If you
  +     * process the event in the same thread as the original change then your
  +     * code will be protected by the original synchronized decorator and this
  +     * collection may be used freely.
        * 
        * @return the collection
        */
  -    public Collection getSourceCollection() {
  +    public ObservedCollection getObservedCollection() {
           return collection;
  +    }
  +
  +    /**
  +     * Gets the base collection underlying the observed collection.
  +     * <p>
  +     * Using this collection will bypass the event sending mechanism.
  +     * It will also bypass any other decorators, such as synchronization.
  +     * Use with care.
  +     * 
  +     * @return the collection
  +     */
  +    public Collection getBaseCollection() {
  +        return handler.getBaseCollection();
       }
   
       /**
  
  
  
  1.4       +67 -22    
jakarta-commons/collections/src/java/org/apache/commons/collections/observed/ModificationHandler.java
  
  Index: ModificationHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/observed/ModificationHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ModificationHandler.java  7 Sep 2003 00:51:31 -0000       1.3
  +++ ModificationHandler.java  7 Sep 2003 10:33:32 -0000       1.4
  @@ -66,6 +66,10 @@
    * <code>preXxx</code> and <code>postXxx</code> naming convention.
    * It also provides a default implementation that forwards to single methods.
    * <p>
  + * To write your own handler, you will normally subclass and override the
  + * <code>preEvent</code> and <code>postEvent</code> methods. However, you
  + * could choose to override any individual event method.
  + * <p>
    * This class could have been implemented as an interface, however to do so
    * would prevent the addition of extra events in the future. It does mean
    * that if you subclass this class, you must check it when you upgrade to a
  @@ -76,17 +80,19 @@
    * 
    * @author Stephen Colebourne
    */
  -public abstract class ModificationHandler {
  +public class ModificationHandler {
       
       /** Singleton factory */
       static final ModificationHandlerFactory FACTORY = new Factory();
       
       /** The collection being observed */
  -    private ObservedCollection collection = null;
  +    private ObservedCollection obsCollection = null;
  +    /** The underlying base collection being decorated */
  +    private Collection baseCollection = null;
       /** The root handler */
  -    protected final ModificationHandler rootHandler;
  +    private final ModificationHandler rootHandler;
       /** The range offset, 0 if not a range */
  -    protected final int rangeOffset;
  +    private final int rangeOffset;
       
       // Constructors
       //-----------------------------------------------------------------------
  @@ -119,28 +125,60 @@
        * All other methods will throw NullPointerException until then.
        * 
        * @param coll  the observed collection, must not be null
  +     * @param baseColl  the base collection, must not be null
        * @throws IllegalArgumentException if the collection is null
        * @throws IllegalStateException if init has already been called
        */
  -    void init(final ObservedCollection coll) {
  +    void init(final ObservedCollection coll, Collection baseColl) {
           if (coll == null) {
               throw new IllegalArgumentException("Collection must not be null");
           }
  -        if (this.collection != null) {
  +        if (baseColl == null) {
  +            throw new IllegalArgumentException("Base Collection must not be null");
  +        }
  +        if (this.obsCollection != null) {
               throw new IllegalArgumentException("init() has already been called");
           }
  -        this.collection = coll;
  +        this.obsCollection = coll;
  +        this.baseCollection = baseColl;
       }
   
  -    // Collection access
  +    // Field access
       //-----------------------------------------------------------------------
       /**
        * Gets the observed collection.
        * 
        * @return the observed collection
        */
  -    public ObservedCollection getCollection() {
  -        return collection;
  +    public ObservedCollection getObservedCollection() {
  +        return obsCollection;
  +    }
  +    
  +    /**
  +     * Gets the base collection.
  +     * 
  +     * @return the base collection
  +     */
  +    protected Collection getBaseCollection() {
  +        return baseCollection;
  +    }
  +    
  +    /**
  +     * Gets the root handler.
  +     * 
  +     * @return the root handler
  +     */
  +    protected ModificationHandler getRootHandler() {
  +        return rootHandler;
  +    }
  +    
  +    /**
  +     * Gets the range offset.
  +     * 
  +     * @return the range offset
  +     */
  +    protected int getRangeOffset() {
  +        return rangeOffset;
       }
       
       // PreListeners
  @@ -245,6 +283,8 @@
       //-----------------------------------------------------------------------
       /**
        * Handles the pre event.
  +     * <p>
  +     * This implementation does nothing.
        * 
        * @param type  the event type to send
        * @param index  the index where the change starts, the method param or derived
  @@ -254,12 +294,16 @@
        * @param range  the range collection, null if no range
        * @param rangeOffset  the offset of the range, -1 if unknown
        */
  -    protected abstract boolean preEvent(
  +    protected boolean preEvent(
               int type, int index, Object object, int repeat,
  -            Object previous, ObservedCollection range, int rangeOffset);
  +            Object previous, ObservedCollection range, int rangeOffset) {
  +        return true;
  +    }
   
       /**
        * Handles the post event.
  +     * <p>
  +     * This implementation does nothing.
        * 
        * @param modified  true if the method succeeded in changing the collection
        * @param type  the event type to send
  @@ -270,9 +314,10 @@
        * @param range  the range collection, null if no range
        * @param rangeOffset  the offset of the range, -1 if unknown
        */
  -    protected abstract void postEvent(
  +    protected void postEvent(
               boolean modified, int type, int index, Object object, int repeat,
  -            Object previous, ObservedCollection range, int rangeOffset);
  +            Object previous, ObservedCollection range, int rangeOffset) {
  +    }
   
       // Event handling
       //-----------------------------------------------------------------------
  @@ -685,7 +730,7 @@
           return new SubListHandler(rootHandler, fromIndex + rangeOffset);
       }
       
  -    protected class SubListHandler extends ModificationHandler {
  +    protected static class SubListHandler extends ModificationHandler {
           
           /**
            * Constructor.
  @@ -706,9 +751,9 @@
                   int type, int index, Object object, int repeat,
                   Object previous, ObservedCollection ignoredRange, int 
ignoredOffset) {
   
  -            return rootHandler.preEvent(
  +            return getRootHandler().preEvent(
                   type, index, object, repeat,
  -                previous, getCollection(), this.rangeOffset);
  +                previous, getObservedCollection(), getRangeOffset());
           }
   
           /**
  @@ -720,9 +765,9 @@
                   boolean modified, int type, int index, Object object, int repeat,
                   Object previous, ObservedCollection ignoredRange, int 
ignoredOffset) {
   
  -            rootHandler.postEvent(
  +            getRootHandler().postEvent(
                   modified, type, index, object, repeat,
  -                previous, getCollection(), this.rangeOffset);
  +                previous, getObservedCollection(), getRangeOffset());
           }
       }
       
  @@ -739,7 +784,7 @@
           if (pos != -1) {
               name = name.substring(pos + 1);
           }
  -        return name + '[' + (collection == null ? "" : "initialised") + ']';
  +        return name + '[' + (obsCollection == null ? "" : "initialised") + ']';
       }
   
       // Factory to create handler from handler
  
  
  
  1.4       +2 -3      
jakarta-commons/collections/src/java/org/apache/commons/collections/observed/ObservedList.java
  
  Index: ObservedList.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/observed/ObservedList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ObservedList.java 7 Sep 2003 00:51:31 -0000       1.3
  +++ ObservedList.java 7 Sep 2003 10:33:32 -0000       1.4
  @@ -58,7 +58,6 @@
   package org.apache.commons.collections.observed;
   
   import java.util.Collection;
  -import java.util.Iterator;
   import java.util.List;
   import java.util.ListIterator;
   
  
  
  
  1.3       +6 -7      
jakarta-commons/collections/src/java/org/apache/commons/collections/observed/standard/StandardPostModificationEvent.java
  
  Index: StandardPostModificationEvent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/observed/standard/StandardPostModificationEvent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardPostModificationEvent.java        7 Sep 2003 00:51:31 -0000       1.2
  +++ StandardPostModificationEvent.java        7 Sep 2003 10:33:33 -0000       1.3
  @@ -57,8 +57,6 @@
    */
   package org.apache.commons.collections.observed.standard;
   
  -import java.util.Collection;
  -
   import org.apache.commons.collections.observed.ModificationHandler;
   import org.apache.commons.collections.observed.ObservedCollection;
   
  @@ -86,7 +84,7 @@
       /**
        * Constructor.
        * 
  -     * @param collection  the event source
  +     * @param obsCollection  the event source
        * @param handler  the handler
        * @param type  the event type
        * @param preSize  the size before the change
  @@ -98,7 +96,7 @@
        * @param rangeOffset  the offset of the range, -1 if unknown
        */
       public StandardPostModificationEvent(
  -        final Collection collection,
  +        final ObservedCollection obsCollection,
           final ModificationHandler handler,
           final int type,
           final int preSize,
  @@ -109,7 +107,8 @@
           final ObservedCollection range,
           final int rangeOffset) {
   
  -        super(collection, handler, type, preSize, index, object, repeat, previous, 
range, rangeOffset);
  +        super(obsCollection, handler, type, preSize, index,
  +            object, repeat, previous, range, rangeOffset);
           postSize = collection.size();
       }
   
  
  
  
  1.4       +5 -5      
jakarta-commons/collections/src/java/org/apache/commons/collections/observed/standard/StandardModificationHandler.java
  
  Index: StandardModificationHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/observed/standard/StandardModificationHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardModificationHandler.java  7 Sep 2003 00:51:31 -0000       1.3
  +++ StandardModificationHandler.java  7 Sep 2003 10:33:33 -0000       1.4
  @@ -437,7 +437,7 @@
               int type, int index, Object object,
               int repeat, Object previous, ObservedCollection range, int rangeOffset) 
{
   
  -        preSize = getCollection().size();
  +        preSize = getObservedCollection().size();
           return firePreEvent(type, index, object, repeat, previous, range, 
rangeOffset);
       }
   
  @@ -465,7 +465,7 @@
                       if ((holder.mask & type) > 0) {
                           if (event == null) {
                               event = new StandardPreModificationEvent(
  -                                getCollection(), this, type, preSize, index, object,
  +                                getObservedCollection(), this, type, preSize, 
index, object,
                                   repeat, previous, range, rangeOffset);
                           }
                           holder.listener.modificationOccurring(event);
  @@ -522,7 +522,7 @@
                       if ((holder.mask & type) > 0) {
                           if (event == null) {
                               event = new StandardPostModificationEvent(
  -                                getCollection(), this, type, preSize, index,
  +                                getObservedCollection(), this, type, preSize, index,
                                   object, repeat, previous, range, rangeOffset);
                           }
                           holder.listener.modificationOccurred(event);
  
  
  
  1.3       +6 -7      
jakarta-commons/collections/src/java/org/apache/commons/collections/observed/standard/StandardPreModificationEvent.java
  
  Index: StandardPreModificationEvent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/observed/standard/StandardPreModificationEvent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardPreModificationEvent.java 7 Sep 2003 00:51:31 -0000       1.2
  +++ StandardPreModificationEvent.java 7 Sep 2003 10:33:33 -0000       1.3
  @@ -57,8 +57,6 @@
    */
   package org.apache.commons.collections.observed.standard;
   
  -import java.util.Collection;
  -
   import org.apache.commons.collections.observed.ModificationHandler;
   import org.apache.commons.collections.observed.ObservedCollection;
   
  @@ -83,7 +81,7 @@
       /**
        * Constructor.
        * 
  -     * @param collection  the event source
  +     * @param obsCollection  the event source
        * @param handler  the handler
        * @param type  the event type
        * @param preSize  the size before the change
  @@ -93,7 +91,7 @@
        * @param previous  the previous value being removed/replaced
        */
       public StandardPreModificationEvent(
  -        final Collection collection,
  +        final ObservedCollection obsCollection,
           final ModificationHandler handler,
           final int type,
           final int preSize,
  @@ -104,7 +102,8 @@
           final ObservedCollection range,
           final int rangeOffset) {
   
  -        super(collection, handler, type, preSize, index, object, repeat, previous, 
range, rangeOffset);
  +        super(obsCollection, handler, type, preSize, index,
  +            object, repeat, previous, range, rangeOffset);
       }
   
   }
  
  
  
  1.5       +5 -5      
jakarta-commons/collections/src/java/org/apache/commons/collections/observed/standard/StandardModificationEvent.java
  
  Index: StandardModificationEvent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/observed/standard/StandardModificationEvent.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardModificationEvent.java    7 Sep 2003 00:51:31 -0000       1.4
  +++ StandardModificationEvent.java    7 Sep 2003 10:33:33 -0000       1.5
  @@ -106,7 +106,7 @@
       /**
        * Constructor.
        * 
  -     * @param collection  the event source
  +     * @param obsCollection  the event source
        * @param handler  the handler
        * @param type  the event type
        * @param preSize  the size before the change
  @@ -118,7 +118,7 @@
        * @param rangeOffset  the offset of the range, -1 if unknown
        */
       public StandardModificationEvent(
  -        final Collection collection,
  +        final ObservedCollection obsCollection,
           final ModificationHandler handler,
           final int type,
           final int preSize,
  @@ -129,7 +129,7 @@
           final ObservedCollection range,
           final int rangeOffset) {
   
  -        super(collection, handler, type);
  +        super(obsCollection, handler, type);
           this.preSize = preSize;
           this.index = index;
           this.object = object;
  
  
  
  1.5       +47 -44    
jakarta-commons/collections/src/test/org/apache/commons/collections/observed/ObservedTestHelper.java
  
  Index: ObservedTestHelper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/observed/ObservedTestHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ObservedTestHelper.java   7 Sep 2003 00:51:32 -0000       1.4
  +++ ObservedTestHelper.java   7 Sep 2003 10:33:33 -0000       1.5
  @@ -344,7 +344,7 @@
           coll.add(SIX);
           Assert.assertEquals(1, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD, LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -355,7 +355,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(0, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -377,13 +377,16 @@
           Assert.assertEquals(false, LISTENER.postEvent.isTypeChange());
           Assert.assertEquals(false, LISTENER.postEvent.isTypeBulk());
           
  +        // this isn't a full test, but...
  +        Assert.assertEquals(false, LISTENER.postEvent.getBaseCollection() 
instanceof ObservedCollection);
  +        
           LISTENER.preEvent = null;
           LISTENER.postEvent = null;
           Assert.assertEquals(1, coll.size());
           coll.add(SEVEN);
           Assert.assertEquals(2, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD, LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -394,7 +397,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(1, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -414,7 +417,7 @@
           coll.add(SIX_SEVEN_LIST);
           Assert.assertEquals(3, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD, LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -425,7 +428,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -451,7 +454,7 @@
           coll.add(1, EIGHT);
           Assert.assertEquals(3, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_INDEXED, 
LISTENER.preEvent.getType());
           Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
  @@ -462,7 +465,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_INDEXED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
  @@ -496,7 +499,7 @@
           coll.add(EIGHT, 3);
           Assert.assertEquals(5, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_NCOPIES, 
LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -507,7 +510,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_NCOPIES, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -543,7 +546,7 @@
           it.add(EIGHT);
           Assert.assertEquals(3, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_ITERATED, 
LISTENER.preEvent.getType());
           Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
  @@ -554,7 +557,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_ITERATED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
  @@ -587,7 +590,7 @@
           coll.addAll(SIX_SEVEN_LIST);
           Assert.assertEquals(2, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_ALL, 
LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -597,7 +600,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(0, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_ALL, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -630,7 +633,7 @@
           coll.addAll(1, SIX_SEVEN_LIST);
           Assert.assertEquals(4, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_ALL_INDEXED, 
LISTENER.preEvent.getType());
           Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
  @@ -640,7 +643,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_ALL_INDEXED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
  @@ -673,7 +676,7 @@
           coll.clear();
           Assert.assertEquals(0, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.CLEAR, 
LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -683,7 +686,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.CLEAR, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -724,7 +727,7 @@
           coll.remove(SEVEN);
           Assert.assertEquals(1, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE, 
LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -735,7 +738,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -777,7 +780,7 @@
           coll.remove(0);
           Assert.assertEquals(1, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_INDEXED, 
LISTENER.preEvent.getType());
           Assert.assertEquals(0, LISTENER.preEvent.getChangeIndex());
  @@ -787,7 +790,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_INDEXED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(0, LISTENER.postEvent.getChangeIndex());
  @@ -821,7 +824,7 @@
           coll.remove(SEVEN, 3);
           Assert.assertEquals(10, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_NCOPIES, 
LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -832,7 +835,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(13, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_NCOPIES, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -869,7 +872,7 @@
           it.remove();
           Assert.assertEquals(1, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, 
LISTENER.preEvent.getType());
           Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
  @@ -880,7 +883,7 @@
           Assert.assertSame(SEVEN, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
  @@ -924,7 +927,7 @@
           it.remove();
           Assert.assertEquals(1, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, 
LISTENER.preEvent.getType());
           Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
  @@ -935,7 +938,7 @@
           Assert.assertSame(SEVEN, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
  @@ -978,7 +981,7 @@
           coll.removeAll(SIX_SEVEN_LIST);
           Assert.assertEquals(1, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_ALL, 
LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -988,7 +991,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(3, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_ALL, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -1030,7 +1033,7 @@
           coll.retainAll(SIX_SEVEN_LIST);
           Assert.assertEquals(2, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.RETAIN_ALL, 
LISTENER.preEvent.getType());
           Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
  @@ -1040,7 +1043,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(3, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.RETAIN_ALL, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -1081,7 +1084,7 @@
           coll.set(0, EIGHT);
           Assert.assertEquals(2, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.SET_INDEXED, 
LISTENER.preEvent.getType());
           Assert.assertEquals(0, LISTENER.preEvent.getChangeIndex());
  @@ -1092,7 +1095,7 @@
           Assert.assertSame(null, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.SET_INDEXED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(0, LISTENER.postEvent.getChangeIndex());
  @@ -1129,7 +1132,7 @@
           it.set(EIGHT);
           Assert.assertEquals(2, coll.size());
           // pre
  -        Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
           Assert.assertEquals(ModificationEventType.SET_ITERATED, 
LISTENER.preEvent.getType());
           Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
  @@ -1140,7 +1143,7 @@
           Assert.assertSame(SEVEN, LISTENER.preEvent.getPrevious());
           Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.SET_ITERATED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
  @@ -1178,7 +1181,7 @@
           subList.add(EIGHT);
           Assert.assertEquals(4, subList.size());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  @@ -1195,7 +1198,7 @@
           subList.add(1, EIGHT);
           Assert.assertEquals(5, subList.size());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.ADD_INDEXED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(2, LISTENER.postEvent.getChangeIndex());
  @@ -1212,7 +1215,7 @@
           subList.set(3, SEVEN);
           Assert.assertEquals(5, subList.size());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.SET_INDEXED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(4, LISTENER.postEvent.getChangeIndex());
  @@ -1232,7 +1235,7 @@
           it.remove();
           Assert.assertEquals(4, subList.size());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
  @@ -1254,7 +1257,7 @@
           it.set(EIGHT);
           Assert.assertEquals(4, subList.size());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.SET_ITERATED, 
LISTENER.postEvent.getType());
           Assert.assertEquals(3, LISTENER.postEvent.getChangeIndex());
  @@ -1272,7 +1275,7 @@
           subList.clear();
           Assert.assertEquals(0, subList.size());
           // post
  -        Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
  +        Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
           Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
           Assert.assertEquals(ModificationEventType.CLEAR, 
LISTENER.postEvent.getType());
           Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to