Make the base collection available to listeners
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131142 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fb1a16e4cc
commit
3c6542af60
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/Attic/ModificationEvent.java,v 1.1 2003/09/03 23:54:26 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/Attic/ModificationEvent.java,v 1.2 2003/09/07 10:33:32 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -66,14 +66,14 @@ import java.util.EventObject;
|
||||||
* This class can be used as is, but generally it is subclassed.
|
* This class can be used as is, but generally it is subclassed.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.1 $ $Date: 2003/09/03 23:54:26 $
|
* @version $Revision: 1.2 $ $Date: 2003/09/07 10:33:32 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public class ModificationEvent extends EventObject {
|
public class ModificationEvent extends EventObject {
|
||||||
|
|
||||||
/** The source collection */
|
/** The source collection */
|
||||||
protected final Collection collection;
|
protected final ObservedCollection collection;
|
||||||
/** The handler */
|
/** The handler */
|
||||||
protected final ModificationHandler handler;
|
protected final ModificationHandler handler;
|
||||||
/** The event code */
|
/** The event code */
|
||||||
|
@ -84,17 +84,17 @@ public class ModificationEvent extends EventObject {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param collection the event source
|
* @param obsCollection the event source
|
||||||
* @param handler the handler
|
* @param handler the handler
|
||||||
* @param type the event type
|
* @param type the event type
|
||||||
*/
|
*/
|
||||||
public ModificationEvent(
|
public ModificationEvent(
|
||||||
final Collection collection,
|
final ObservedCollection obsCollection,
|
||||||
final ModificationHandler handler,
|
final ModificationHandler handler,
|
||||||
final int type) {
|
final int type) {
|
||||||
|
|
||||||
super(collection);
|
super(obsCollection);
|
||||||
this.collection = collection;
|
this.collection = obsCollection;
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
@ -104,18 +104,34 @@ public class ModificationEvent extends EventObject {
|
||||||
/**
|
/**
|
||||||
* Gets the collection the event is reporting on.
|
* Gets the collection the event is reporting on.
|
||||||
* <p>
|
* <p>
|
||||||
* This method returns the <code>ObservedCollection</code> instance.
|
* Using this collection will bypass any decorators that have been added
|
||||||
* If this collection is wrapped, by a synchronized wrapper for example,
|
* to the <code>ObservedCollection</code>. For example, if a synchronized
|
||||||
* changing this collection will bypass the wrapper. For the synchronized
|
* decorator was added it will not be called by changes to this collection.
|
||||||
* example, this will be OK so long as the event is processed in the same
|
* <p>
|
||||||
* thread and program stack as the modification was made in.
|
* 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
|
* @return the collection
|
||||||
*/
|
*/
|
||||||
public Collection getSourceCollection() {
|
public ObservedCollection getObservedCollection() {
|
||||||
return collection;
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the handler of the events.
|
* Gets the handler of the events.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/Attic/ModificationHandler.java,v 1.3 2003/09/07 00:51:31 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/Attic/ModificationHandler.java,v 1.4 2003/09/07 10:33:32 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -66,27 +66,33 @@ import java.util.Collection;
|
||||||
* <code>preXxx</code> and <code>postXxx</code> naming convention.
|
* <code>preXxx</code> and <code>postXxx</code> naming convention.
|
||||||
* It also provides a default implementation that forwards to single methods.
|
* It also provides a default implementation that forwards to single methods.
|
||||||
* <p>
|
* <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
|
* 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
|
* 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
|
* that if you subclass this class, you must check it when you upgrade to a
|
||||||
* later collections release.
|
* later collections release.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.3 $ $Date: 2003/09/07 00:51:31 $
|
* @version $Revision: 1.4 $ $Date: 2003/09/07 10:33:32 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public abstract class ModificationHandler {
|
public class ModificationHandler {
|
||||||
|
|
||||||
/** Singleton factory */
|
/** Singleton factory */
|
||||||
static final ModificationHandlerFactory FACTORY = new Factory();
|
static final ModificationHandlerFactory FACTORY = new Factory();
|
||||||
|
|
||||||
/** The collection being observed */
|
/** 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 */
|
/** The root handler */
|
||||||
protected final ModificationHandler rootHandler;
|
private final ModificationHandler rootHandler;
|
||||||
/** The range offset, 0 if not a range */
|
/** The range offset, 0 if not a range */
|
||||||
protected final int rangeOffset;
|
private final int rangeOffset;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
@ -119,28 +125,60 @@ public abstract class ModificationHandler {
|
||||||
* All other methods will throw NullPointerException until then.
|
* All other methods will throw NullPointerException until then.
|
||||||
*
|
*
|
||||||
* @param coll the observed collection, must not be null
|
* @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 IllegalArgumentException if the collection is null
|
||||||
* @throws IllegalStateException if init has already been called
|
* @throws IllegalStateException if init has already been called
|
||||||
*/
|
*/
|
||||||
void init(final ObservedCollection coll) {
|
void init(final ObservedCollection coll, Collection baseColl) {
|
||||||
if (coll == null) {
|
if (coll == null) {
|
||||||
throw new IllegalArgumentException("Collection must not be 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");
|
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.
|
* Gets the observed collection.
|
||||||
*
|
*
|
||||||
* @return the observed collection
|
* @return the observed collection
|
||||||
*/
|
*/
|
||||||
public ObservedCollection getCollection() {
|
public ObservedCollection getObservedCollection() {
|
||||||
return collection;
|
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
|
// PreListeners
|
||||||
|
@ -245,6 +283,8 @@ public abstract class ModificationHandler {
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Handles the pre event.
|
* Handles the pre event.
|
||||||
|
* <p>
|
||||||
|
* This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param type the event type to send
|
* @param type the event type to send
|
||||||
* @param index the index where the change starts, the method param or derived
|
* @param index the index where the change starts, the method param or derived
|
||||||
|
@ -254,12 +294,16 @@ public abstract class ModificationHandler {
|
||||||
* @param range the range collection, null if no range
|
* @param range the range collection, null if no range
|
||||||
* @param rangeOffset the offset of the range, -1 if unknown
|
* @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,
|
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.
|
* Handles the post event.
|
||||||
|
* <p>
|
||||||
|
* This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param modified true if the method succeeded in changing the collection
|
* @param modified true if the method succeeded in changing the collection
|
||||||
* @param type the event type to send
|
* @param type the event type to send
|
||||||
|
@ -270,9 +314,10 @@ public abstract class ModificationHandler {
|
||||||
* @param range the range collection, null if no range
|
* @param range the range collection, null if no range
|
||||||
* @param rangeOffset the offset of the range, -1 if unknown
|
* @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,
|
boolean modified, int type, int index, Object object, int repeat,
|
||||||
Object previous, ObservedCollection range, int rangeOffset);
|
Object previous, ObservedCollection range, int rangeOffset) {
|
||||||
|
}
|
||||||
|
|
||||||
// Event handling
|
// Event handling
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
@ -685,7 +730,7 @@ public abstract class ModificationHandler {
|
||||||
return new SubListHandler(rootHandler, fromIndex + rangeOffset);
|
return new SubListHandler(rootHandler, fromIndex + rangeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class SubListHandler extends ModificationHandler {
|
protected static class SubListHandler extends ModificationHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -706,9 +751,9 @@ public abstract class ModificationHandler {
|
||||||
int type, int index, Object object, int repeat,
|
int type, int index, Object object, int repeat,
|
||||||
Object previous, ObservedCollection ignoredRange, int ignoredOffset) {
|
Object previous, ObservedCollection ignoredRange, int ignoredOffset) {
|
||||||
|
|
||||||
return rootHandler.preEvent(
|
return getRootHandler().preEvent(
|
||||||
type, index, object, repeat,
|
type, index, object, repeat,
|
||||||
previous, getCollection(), this.rangeOffset);
|
previous, getObservedCollection(), getRangeOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -720,9 +765,9 @@ public abstract class ModificationHandler {
|
||||||
boolean modified, int type, int index, Object object, int repeat,
|
boolean modified, int type, int index, Object object, int repeat,
|
||||||
Object previous, ObservedCollection ignoredRange, int ignoredOffset) {
|
Object previous, ObservedCollection ignoredRange, int ignoredOffset) {
|
||||||
|
|
||||||
rootHandler.postEvent(
|
getRootHandler().postEvent(
|
||||||
modified, type, index, object, repeat,
|
modified, type, index, object, repeat,
|
||||||
previous, getCollection(), this.rangeOffset);
|
previous, getObservedCollection(), getRangeOffset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,7 +784,7 @@ public abstract class ModificationHandler {
|
||||||
if (pos != -1) {
|
if (pos != -1) {
|
||||||
name = name.substring(pos + 1);
|
name = name.substring(pos + 1);
|
||||||
}
|
}
|
||||||
return name + '[' + (collection == null ? "" : "initialised") + ']';
|
return name + '[' + (obsCollection == null ? "" : "initialised") + ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Factory to create handler from handler
|
// Factory to create handler from handler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/Attic/ObservedCollection.java,v 1.3 2003/09/07 00:51:31 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/Attic/ObservedCollection.java,v 1.4 2003/09/07 10:33:32 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -74,7 +74,7 @@ import org.apache.commons.collections.observed.standard.StandardModificationHand
|
||||||
* See this class for details of configuration available.
|
* See this class for details of configuration available.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.3 $ $Date: 2003/09/07 00:51:31 $
|
* @version $Revision: 1.4 $ $Date: 2003/09/07 10:33:32 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
@ -193,7 +193,7 @@ public class ObservedCollection extends AbstractCollectionDecorator {
|
||||||
final Object listener) {
|
final Object listener) {
|
||||||
super(coll);
|
super(coll);
|
||||||
this.handler = createHandler(coll, listener);
|
this.handler = createHandler(coll, listener);
|
||||||
this.handler.init(this);
|
this.handler.init(this, coll);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/Attic/ObservedList.java,v 1.3 2003/09/07 00:51:31 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/Attic/ObservedList.java,v 1.4 2003/09/07 10:33:32 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -58,7 +58,6 @@
|
||||||
package org.apache.commons.collections.observed;
|
package org.apache.commons.collections.observed;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ import org.apache.commons.collections.decorators.AbstractListIteratorDecorator;
|
||||||
* base <code>List</code>.
|
* base <code>List</code>.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.3 $ $Date: 2003/09/07 00:51:31 $
|
* @version $Revision: 1.4 $ $Date: 2003/09/07 10:33:32 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/standard/Attic/StandardModificationEvent.java,v 1.4 2003/09/07 00:51:31 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/standard/Attic/StandardModificationEvent.java,v 1.5 2003/09/07 10:33:33 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -80,7 +80,7 @@ import org.apache.commons.collections.observed.ObservedCollection;
|
||||||
* All objects used are the real objects from the method calls, not clones.
|
* All objects used are the real objects from the method calls, not clones.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.4 $ $Date: 2003/09/07 00:51:31 $
|
* @version $Revision: 1.5 $ $Date: 2003/09/07 10:33:33 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
@ -106,7 +106,7 @@ public class StandardModificationEvent extends ModificationEvent {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param collection the event source
|
* @param obsCollection the event source
|
||||||
* @param handler the handler
|
* @param handler the handler
|
||||||
* @param type the event type
|
* @param type the event type
|
||||||
* @param preSize the size before the change
|
* @param preSize the size before the change
|
||||||
|
@ -118,7 +118,7 @@ public class StandardModificationEvent extends ModificationEvent {
|
||||||
* @param rangeOffset the offset of the range, -1 if unknown
|
* @param rangeOffset the offset of the range, -1 if unknown
|
||||||
*/
|
*/
|
||||||
public StandardModificationEvent(
|
public StandardModificationEvent(
|
||||||
final Collection collection,
|
final ObservedCollection obsCollection,
|
||||||
final ModificationHandler handler,
|
final ModificationHandler handler,
|
||||||
final int type,
|
final int type,
|
||||||
final int preSize,
|
final int preSize,
|
||||||
|
@ -129,7 +129,7 @@ public class StandardModificationEvent extends ModificationEvent {
|
||||||
final ObservedCollection range,
|
final ObservedCollection range,
|
||||||
final int rangeOffset) {
|
final int rangeOffset) {
|
||||||
|
|
||||||
super(collection, handler, type);
|
super(obsCollection, handler, type);
|
||||||
this.preSize = preSize;
|
this.preSize = preSize;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.object = object;
|
this.object = object;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/standard/Attic/StandardModificationHandler.java,v 1.3 2003/09/07 00:51:31 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/standard/Attic/StandardModificationHandler.java,v 1.4 2003/09/07 10:33:33 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -77,7 +77,7 @@ import org.apache.commons.collections.observed.ObservedCollection;
|
||||||
* modification events.
|
* modification events.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.3 $ $Date: 2003/09/07 00:51:31 $
|
* @version $Revision: 1.4 $ $Date: 2003/09/07 10:33:33 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
@ -437,7 +437,7 @@ public class StandardModificationHandler extends ModificationHandler {
|
||||||
int type, int index, Object object,
|
int type, int index, Object object,
|
||||||
int repeat, Object previous, ObservedCollection range, int rangeOffset) {
|
int repeat, Object previous, ObservedCollection range, int rangeOffset) {
|
||||||
|
|
||||||
preSize = getCollection().size();
|
preSize = getObservedCollection().size();
|
||||||
return firePreEvent(type, index, object, repeat, previous, range, rangeOffset);
|
return firePreEvent(type, index, object, repeat, previous, range, rangeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ public class StandardModificationHandler extends ModificationHandler {
|
||||||
if ((holder.mask & type) > 0) {
|
if ((holder.mask & type) > 0) {
|
||||||
if (event == null) {
|
if (event == null) {
|
||||||
event = new StandardPreModificationEvent(
|
event = new StandardPreModificationEvent(
|
||||||
getCollection(), this, type, preSize, index, object,
|
getObservedCollection(), this, type, preSize, index, object,
|
||||||
repeat, previous, range, rangeOffset);
|
repeat, previous, range, rangeOffset);
|
||||||
}
|
}
|
||||||
holder.listener.modificationOccurring(event);
|
holder.listener.modificationOccurring(event);
|
||||||
|
@ -522,7 +522,7 @@ public class StandardModificationHandler extends ModificationHandler {
|
||||||
if ((holder.mask & type) > 0) {
|
if ((holder.mask & type) > 0) {
|
||||||
if (event == null) {
|
if (event == null) {
|
||||||
event = new StandardPostModificationEvent(
|
event = new StandardPostModificationEvent(
|
||||||
getCollection(), this, type, preSize, index,
|
getObservedCollection(), this, type, preSize, index,
|
||||||
object, repeat, previous, range, rangeOffset);
|
object, repeat, previous, range, rangeOffset);
|
||||||
}
|
}
|
||||||
holder.listener.modificationOccurred(event);
|
holder.listener.modificationOccurred(event);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/standard/Attic/StandardPostModificationEvent.java,v 1.2 2003/09/07 00:51:31 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/standard/Attic/StandardPostModificationEvent.java,v 1.3 2003/09/07 10:33:33 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -57,8 +57,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.commons.collections.observed.standard;
|
package org.apache.commons.collections.observed.standard;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.apache.commons.collections.observed.ModificationHandler;
|
import org.apache.commons.collections.observed.ModificationHandler;
|
||||||
import org.apache.commons.collections.observed.ObservedCollection;
|
import org.apache.commons.collections.observed.ObservedCollection;
|
||||||
|
|
||||||
|
@ -72,7 +70,7 @@ import org.apache.commons.collections.observed.ObservedCollection;
|
||||||
* All objects used are the real objects from the method calls, not clones.
|
* All objects used are the real objects from the method calls, not clones.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.2 $ $Date: 2003/09/07 00:51:31 $
|
* @version $Revision: 1.3 $ $Date: 2003/09/07 10:33:33 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
@ -86,7 +84,7 @@ public class StandardPostModificationEvent extends StandardModificationEvent {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param collection the event source
|
* @param obsCollection the event source
|
||||||
* @param handler the handler
|
* @param handler the handler
|
||||||
* @param type the event type
|
* @param type the event type
|
||||||
* @param preSize the size before the change
|
* @param preSize the size before the change
|
||||||
|
@ -98,7 +96,7 @@ public class StandardPostModificationEvent extends StandardModificationEvent {
|
||||||
* @param rangeOffset the offset of the range, -1 if unknown
|
* @param rangeOffset the offset of the range, -1 if unknown
|
||||||
*/
|
*/
|
||||||
public StandardPostModificationEvent(
|
public StandardPostModificationEvent(
|
||||||
final Collection collection,
|
final ObservedCollection obsCollection,
|
||||||
final ModificationHandler handler,
|
final ModificationHandler handler,
|
||||||
final int type,
|
final int type,
|
||||||
final int preSize,
|
final int preSize,
|
||||||
|
@ -109,7 +107,8 @@ public class StandardPostModificationEvent extends StandardModificationEvent {
|
||||||
final ObservedCollection range,
|
final ObservedCollection range,
|
||||||
final int rangeOffset) {
|
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();
|
postSize = collection.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/standard/Attic/StandardPreModificationEvent.java,v 1.2 2003/09/07 00:51:31 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/observed/standard/Attic/StandardPreModificationEvent.java,v 1.3 2003/09/07 10:33:33 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -57,8 +57,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.commons.collections.observed.standard;
|
package org.apache.commons.collections.observed.standard;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.apache.commons.collections.observed.ModificationHandler;
|
import org.apache.commons.collections.observed.ModificationHandler;
|
||||||
import org.apache.commons.collections.observed.ObservedCollection;
|
import org.apache.commons.collections.observed.ObservedCollection;
|
||||||
|
|
||||||
|
@ -72,7 +70,7 @@ import org.apache.commons.collections.observed.ObservedCollection;
|
||||||
* All objects used are the real objects from the method calls, not clones.
|
* All objects used are the real objects from the method calls, not clones.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.2 $ $Date: 2003/09/07 00:51:31 $
|
* @version $Revision: 1.3 $ $Date: 2003/09/07 10:33:33 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
@ -83,7 +81,7 @@ public class StandardPreModificationEvent extends StandardModificationEvent {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param collection the event source
|
* @param obsCollection the event source
|
||||||
* @param handler the handler
|
* @param handler the handler
|
||||||
* @param type the event type
|
* @param type the event type
|
||||||
* @param preSize the size before the change
|
* @param preSize the size before the change
|
||||||
|
@ -93,7 +91,7 @@ public class StandardPreModificationEvent extends StandardModificationEvent {
|
||||||
* @param previous the previous value being removed/replaced
|
* @param previous the previous value being removed/replaced
|
||||||
*/
|
*/
|
||||||
public StandardPreModificationEvent(
|
public StandardPreModificationEvent(
|
||||||
final Collection collection,
|
final ObservedCollection obsCollection,
|
||||||
final ModificationHandler handler,
|
final ModificationHandler handler,
|
||||||
final int type,
|
final int type,
|
||||||
final int preSize,
|
final int preSize,
|
||||||
|
@ -104,7 +102,8 @@ public class StandardPreModificationEvent extends StandardModificationEvent {
|
||||||
final ObservedCollection range,
|
final ObservedCollection range,
|
||||||
final int rangeOffset) {
|
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 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/ObservedTestHelper.java,v 1.4 2003/09/07 00:51:32 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/ObservedTestHelper.java,v 1.5 2003/09/07 10:33:33 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -76,7 +76,7 @@ import org.apache.commons.collections.observed.standard.StandardPreModificationL
|
||||||
* {@link ObservedCollection} implementations.
|
* {@link ObservedCollection} implementations.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.4 $ $Date: 2003/09/07 00:51:32 $
|
* @version $Revision: 1.5 $ $Date: 2003/09/07 10:33:33 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
@ -344,7 +344,7 @@ public class ObservedTestHelper {
|
||||||
coll.add(SIX);
|
coll.add(SIX);
|
||||||
Assert.assertEquals(1, coll.size());
|
Assert.assertEquals(1, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -355,7 +355,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(0, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(0, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -377,13 +377,16 @@ public class ObservedTestHelper {
|
||||||
Assert.assertEquals(false, LISTENER.postEvent.isTypeChange());
|
Assert.assertEquals(false, LISTENER.postEvent.isTypeChange());
|
||||||
Assert.assertEquals(false, LISTENER.postEvent.isTypeBulk());
|
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.preEvent = null;
|
||||||
LISTENER.postEvent = null;
|
LISTENER.postEvent = null;
|
||||||
Assert.assertEquals(1, coll.size());
|
Assert.assertEquals(1, coll.size());
|
||||||
coll.add(SEVEN);
|
coll.add(SEVEN);
|
||||||
Assert.assertEquals(2, coll.size());
|
Assert.assertEquals(2, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -394,7 +397,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(1, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(1, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -414,7 +417,7 @@ public class ObservedTestHelper {
|
||||||
coll.add(SIX_SEVEN_LIST);
|
coll.add(SIX_SEVEN_LIST);
|
||||||
Assert.assertEquals(3, coll.size());
|
Assert.assertEquals(3, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -425,7 +428,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -451,7 +454,7 @@ public class ObservedTestHelper {
|
||||||
coll.add(1, EIGHT);
|
coll.add(1, EIGHT);
|
||||||
Assert.assertEquals(3, coll.size());
|
Assert.assertEquals(3, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_INDEXED, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_INDEXED, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -462,7 +465,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_INDEXED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_INDEXED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -496,7 +499,7 @@ public class ObservedTestHelper {
|
||||||
coll.add(EIGHT, 3);
|
coll.add(EIGHT, 3);
|
||||||
Assert.assertEquals(5, coll.size());
|
Assert.assertEquals(5, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_NCOPIES, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_NCOPIES, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -507,7 +510,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_NCOPIES, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_NCOPIES, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -543,7 +546,7 @@ public class ObservedTestHelper {
|
||||||
it.add(EIGHT);
|
it.add(EIGHT);
|
||||||
Assert.assertEquals(3, coll.size());
|
Assert.assertEquals(3, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_ITERATED, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_ITERATED, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -554,7 +557,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_ITERATED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_ITERATED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -587,7 +590,7 @@ public class ObservedTestHelper {
|
||||||
coll.addAll(SIX_SEVEN_LIST);
|
coll.addAll(SIX_SEVEN_LIST);
|
||||||
Assert.assertEquals(2, coll.size());
|
Assert.assertEquals(2, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_ALL, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_ALL, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -597,7 +600,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(0, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(0, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_ALL, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_ALL, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -630,7 +633,7 @@ public class ObservedTestHelper {
|
||||||
coll.addAll(1, SIX_SEVEN_LIST);
|
coll.addAll(1, SIX_SEVEN_LIST);
|
||||||
Assert.assertEquals(4, coll.size());
|
Assert.assertEquals(4, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_ALL_INDEXED, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_ALL_INDEXED, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -640,7 +643,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_ALL_INDEXED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_ALL_INDEXED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -673,7 +676,7 @@ public class ObservedTestHelper {
|
||||||
coll.clear();
|
coll.clear();
|
||||||
Assert.assertEquals(0, coll.size());
|
Assert.assertEquals(0, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.CLEAR, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.CLEAR, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -683,7 +686,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.CLEAR, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.CLEAR, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -724,7 +727,7 @@ public class ObservedTestHelper {
|
||||||
coll.remove(SEVEN);
|
coll.remove(SEVEN);
|
||||||
Assert.assertEquals(1, coll.size());
|
Assert.assertEquals(1, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -735,7 +738,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -777,7 +780,7 @@ public class ObservedTestHelper {
|
||||||
coll.remove(0);
|
coll.remove(0);
|
||||||
Assert.assertEquals(1, coll.size());
|
Assert.assertEquals(1, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_INDEXED, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_INDEXED, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(0, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(0, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -787,7 +790,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_INDEXED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_INDEXED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(0, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(0, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -821,7 +824,7 @@ public class ObservedTestHelper {
|
||||||
coll.remove(SEVEN, 3);
|
coll.remove(SEVEN, 3);
|
||||||
Assert.assertEquals(10, coll.size());
|
Assert.assertEquals(10, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_NCOPIES, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_NCOPIES, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -832,7 +835,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(13, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(13, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_NCOPIES, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_NCOPIES, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -869,7 +872,7 @@ public class ObservedTestHelper {
|
||||||
it.remove();
|
it.remove();
|
||||||
Assert.assertEquals(1, coll.size());
|
Assert.assertEquals(1, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -880,7 +883,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(SEVEN, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(SEVEN, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -924,7 +927,7 @@ public class ObservedTestHelper {
|
||||||
it.remove();
|
it.remove();
|
||||||
Assert.assertEquals(1, coll.size());
|
Assert.assertEquals(1, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -935,7 +938,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(SEVEN, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(SEVEN, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -978,7 +981,7 @@ public class ObservedTestHelper {
|
||||||
coll.removeAll(SIX_SEVEN_LIST);
|
coll.removeAll(SIX_SEVEN_LIST);
|
||||||
Assert.assertEquals(1, coll.size());
|
Assert.assertEquals(1, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_ALL, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_ALL, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -988,7 +991,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(3, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(3, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_ALL, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_ALL, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -1030,7 +1033,7 @@ public class ObservedTestHelper {
|
||||||
coll.retainAll(SIX_SEVEN_LIST);
|
coll.retainAll(SIX_SEVEN_LIST);
|
||||||
Assert.assertEquals(2, coll.size());
|
Assert.assertEquals(2, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.RETAIN_ALL, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.RETAIN_ALL, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -1040,7 +1043,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(3, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(3, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.RETAIN_ALL, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.RETAIN_ALL, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -1081,7 +1084,7 @@ public class ObservedTestHelper {
|
||||||
coll.set(0, EIGHT);
|
coll.set(0, EIGHT);
|
||||||
Assert.assertEquals(2, coll.size());
|
Assert.assertEquals(2, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.SET_INDEXED, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.SET_INDEXED, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(0, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(0, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -1092,7 +1095,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(null, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.SET_INDEXED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.SET_INDEXED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(0, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(0, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -1129,7 +1132,7 @@ public class ObservedTestHelper {
|
||||||
it.set(EIGHT);
|
it.set(EIGHT);
|
||||||
Assert.assertEquals(2, coll.size());
|
Assert.assertEquals(2, coll.size());
|
||||||
// pre
|
// pre
|
||||||
Assert.assertSame(coll, LISTENER.preEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.preEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.preEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.SET_ITERATED, LISTENER.preEvent.getType());
|
Assert.assertEquals(ModificationEventType.SET_ITERATED, LISTENER.preEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.preEvent.getChangeIndex());
|
||||||
|
@ -1140,7 +1143,7 @@ public class ObservedTestHelper {
|
||||||
Assert.assertSame(SEVEN, LISTENER.preEvent.getPrevious());
|
Assert.assertSame(SEVEN, LISTENER.preEvent.getPrevious());
|
||||||
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
Assert.assertEquals(2, LISTENER.preEvent.getPreSize());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.SET_ITERATED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.SET_ITERATED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -1178,7 +1181,7 @@ public class ObservedTestHelper {
|
||||||
subList.add(EIGHT);
|
subList.add(EIGHT);
|
||||||
Assert.assertEquals(4, subList.size());
|
Assert.assertEquals(4, subList.size());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -1195,7 +1198,7 @@ public class ObservedTestHelper {
|
||||||
subList.add(1, EIGHT);
|
subList.add(1, EIGHT);
|
||||||
Assert.assertEquals(5, subList.size());
|
Assert.assertEquals(5, subList.size());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.ADD_INDEXED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.ADD_INDEXED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(2, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(2, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -1212,7 +1215,7 @@ public class ObservedTestHelper {
|
||||||
subList.set(3, SEVEN);
|
subList.set(3, SEVEN);
|
||||||
Assert.assertEquals(5, subList.size());
|
Assert.assertEquals(5, subList.size());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.SET_INDEXED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.SET_INDEXED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(4, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(4, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -1232,7 +1235,7 @@ public class ObservedTestHelper {
|
||||||
it.remove();
|
it.remove();
|
||||||
Assert.assertEquals(4, subList.size());
|
Assert.assertEquals(4, subList.size());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.REMOVE_ITERATED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -1254,7 +1257,7 @@ public class ObservedTestHelper {
|
||||||
it.set(EIGHT);
|
it.set(EIGHT);
|
||||||
Assert.assertEquals(4, subList.size());
|
Assert.assertEquals(4, subList.size());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.SET_ITERATED, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.SET_ITERATED, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(3, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(3, LISTENER.postEvent.getChangeIndex());
|
||||||
|
@ -1272,7 +1275,7 @@ public class ObservedTestHelper {
|
||||||
subList.clear();
|
subList.clear();
|
||||||
Assert.assertEquals(0, subList.size());
|
Assert.assertEquals(0, subList.size());
|
||||||
// post
|
// post
|
||||||
Assert.assertSame(coll, LISTENER.postEvent.getSourceCollection());
|
Assert.assertSame(coll, LISTENER.postEvent.getObservedCollection());
|
||||||
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
Assert.assertSame(coll.getHandler(), LISTENER.postEvent.getHandler());
|
||||||
Assert.assertEquals(ModificationEventType.CLEAR, LISTENER.postEvent.getType());
|
Assert.assertEquals(ModificationEventType.CLEAR, LISTENER.postEvent.getType());
|
||||||
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
Assert.assertEquals(-1, LISTENER.postEvent.getChangeIndex());
|
||||||
|
|
Loading…
Reference in New Issue