From 21cc633fdeb3da6ac5ce452778d20dea690a6b48 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Sun, 21 Sep 2003 20:00:29 +0000 Subject: [PATCH] Rename range to view git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131180 13f79535-47bb-0310-9956-ffa450edef68 --- .../standard/StandardModificationEvent.java | 54 ++++++++++--------- .../standard/StandardModificationHandler.java | 44 +++++++-------- .../StandardPostModificationEvent.java | 14 ++--- .../StandardPreModificationEvent.java | 12 +++-- 4 files changed, 65 insertions(+), 59 deletions(-) diff --git a/src/java/org/apache/commons/collections/observed/standard/StandardModificationEvent.java b/src/java/org/apache/commons/collections/observed/standard/StandardModificationEvent.java index f720e3977..567ec4e74 100644 --- a/src/java/org/apache/commons/collections/observed/standard/StandardModificationEvent.java +++ b/src/java/org/apache/commons/collections/observed/standard/StandardModificationEvent.java @@ -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.6 2003/09/21 16:00:28 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.7 2003/09/21 20:00:29 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -80,7 +80,7 @@ import org.apache.commons.collections.observed.ObservableCollection; * All objects used are the real objects from the method calls, not clones. * * @since Commons Collections 3.0 - * @version $Revision: 1.6 $ $Date: 2003/09/21 16:00:28 $ + * @version $Revision: 1.7 $ $Date: 2003/09/21 20:00:29 $ * * @author Stephen Colebourne */ @@ -96,10 +96,10 @@ public class StandardModificationEvent extends ModificationEvent { protected final int repeat; /** The result of the method call */ protected final Object previous; - /** The range that the event came from, null if none */ - protected final ObservableCollection range; - /** The offset of the range that the event came from, -1 if none */ - protected final int rangeOffset; + /** The view that the event came from, null if none */ + protected final ObservableCollection view; + /** The offset index within the main collection of the view, -1 if none */ + protected final int viewOffset; // Constructor //----------------------------------------------------------------------- @@ -114,8 +114,8 @@ public class StandardModificationEvent extends ModificationEvent { * @param object the value that changed * @param repeat the number of repeats * @param previous the previous value being removed/replaced - * @param range the range collection, null if no range - * @param rangeOffset the offset of the range, -1 if unknown + * @param view the view collection, null if event from main collection + * @param viewOffset the offset within the main collection of the view, -1 if unknown */ public StandardModificationEvent( final ObservableCollection obsCollection, @@ -126,8 +126,8 @@ public class StandardModificationEvent extends ModificationEvent { final Object object, final int repeat, final Object previous, - final ObservableCollection range, - final int rangeOffset) { + final ObservableCollection view, + final int viewOffset) { super(obsCollection, handler, type); this.preSize = preSize; @@ -135,8 +135,8 @@ public class StandardModificationEvent extends ModificationEvent { this.object = object; this.repeat = repeat; this.previous = previous; - this.range = range; - this.rangeOffset = rangeOffset; + this.view = view; + this.viewOffset = viewOffset; } // Change info @@ -223,33 +223,37 @@ public class StandardModificationEvent extends ModificationEvent { return preSize; } - // Range info + // View info //----------------------------------------------------------------------- /** - * Gets the range, null if none. + * Gets the view, null if none. + *

+ * A view is a subSet, headSet, tailSet, subList and so on. * - * @return the range + * @return the view */ - public ObservableCollection getRange() { - return range; + public ObservableCollection getView() { + return view; } /** - * Checks whether the event originated from a range. + * Checks whether the event originated from a view. * - * @return the range + * @return true if event came from a view */ - public boolean isRange() { - return (range != null); + public boolean isView() { + return (view != null); } /** - * Gets the range offset, -1 if no range or unknown offset. + * Gets the view offset, -1 if no view or unknown offset. + *

+ * This refers to the index of the start of the view within the main collection. * - * @return the range offset + * @return the view offset */ - public int getRangeOffset() { - return rangeOffset; + public int getViewOffset() { + return viewOffset; } // Event type diff --git a/src/java/org/apache/commons/collections/observed/standard/StandardModificationHandler.java b/src/java/org/apache/commons/collections/observed/standard/StandardModificationHandler.java index b4237c3c5..c65ff2e2f 100644 --- a/src/java/org/apache/commons/collections/observed/standard/StandardModificationHandler.java +++ b/src/java/org/apache/commons/collections/observed/standard/StandardModificationHandler.java @@ -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.5 2003/09/21 16:00:28 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.6 2003/09/21 20:00:29 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -77,7 +77,7 @@ import org.apache.commons.collections.observed.ObservableCollection; * modification events. * * @since Commons Collections 3.0 - * @version $Revision: 1.5 $ $Date: 2003/09/21 16:00:28 $ + * @version $Revision: 1.6 $ $Date: 2003/09/21 20:00:29 $ * * @author Stephen Colebourne */ @@ -429,16 +429,16 @@ public class StandardModificationHandler extends ModificationHandler { * @param object the object that will be added/removed/set, the method param or derived * @param repeat the number of repeats of the add/remove, the method param or derived * @param previous the previous value that will be removed/replaced, must exist in coll - * @param range the range collection, null if no range - * @param rangeOffset the offset of the range, -1 if unknown + * @param view the view collection that the change was actioned on, null if no view + * @param viewOffset the offset of the subList view, -1 if unknown * @return true to call the decorated collection */ protected boolean preEvent( int type, int index, Object object, - int repeat, Object previous, ObservableCollection range, int rangeOffset) { + int repeat, Object previous, ObservableCollection view, int viewOffset) { preSize = getObservedCollection().size(); - return firePreEvent(type, index, object, repeat, previous, range, rangeOffset); + return firePreEvent(type, index, object, repeat, previous, view, viewOffset); } /** @@ -449,13 +449,13 @@ public class StandardModificationHandler extends ModificationHandler { * @param object the object that will be added/removed/set, the method param or derived * @param repeat the number of repeats of the add/remove, the method param or derived * @param previous the previous value that will be removed/replaced, must exist in coll - * @param range the range collection, null if no range - * @param rangeOffset the offset of the range, -1 if unknown + * @param view the view collection that the change was actioned on, null if no view + * @param viewOffset the offset of the subList view, -1 if unknown * @return true to call the decorated collection */ protected boolean firePreEvent( int type, int index, Object object, int repeat, - Object previous, ObservableCollection range, int rangeOffset) { + Object previous, ObservableCollection view, int viewOffset) { if ((preMask & type) > 0) { StandardPreModificationEvent event = null; @@ -466,7 +466,7 @@ public class StandardModificationHandler extends ModificationHandler { if (event == null) { event = new StandardPreModificationEvent( getObservedCollection(), this, type, preSize, index, object, - repeat, previous, range, rangeOffset); + repeat, previous, view, viewOffset); } holder.listener.modificationOccurring(event); } @@ -484,18 +484,18 @@ public class StandardModificationHandler extends ModificationHandler { * @param modified true if the method succeeded in changing the collection * @param type the event type to send * @param index the index where the change starts, the method param or derived - * @param object the object that will be added/removed/set, the method param or derived + * @param object the object that was added/removed/set, the method param or derived * @param repeat the number of repeats of the add/remove, the method param or derived - * @param previous the previous value that will be removed/replaced, must exist in coll - * @param range the range collection, null if no range - * @param rangeOffset the offset of the range, -1 if unknown + * @param previous the previous value that was removed/replace, must have existed in coll + * @param view the view collection that the change was actioned on, null if no view + * @param viewOffset the offset of the subList view, -1 if unknown */ protected void postEvent( boolean modified, int type, int index, Object object, - int repeat, Object previous, ObservableCollection range, int rangeOffset) { + int repeat, Object previous, ObservableCollection view, int viewOffset) { if (modified) { - firePostEvent(type, index, object, repeat, previous, range, rangeOffset); + firePostEvent(type, index, object, repeat, previous, view, viewOffset); } } @@ -504,15 +504,15 @@ public class StandardModificationHandler extends ModificationHandler { * * @param type the event type to send * @param index the index where the change starts, the method param or derived - * @param object the object that will be added/removed/set, the method param or derived + * @param object the object that was added/removed/set, the method param or derived * @param repeat the number of repeats of the add/remove, the method param or derived - * @param previous the previous value that will be removed/replaced, must exist in coll - * @param range the range collection, null if no range - * @param rangeOffset the offset of the range, -1 if unknown + * @param previous the previous value that was removed/replace, must have existed in coll + * @param view the view collection that the change was actioned on, null if no view + * @param viewOffset the offset of the subList view, -1 if unknown */ protected void firePostEvent( int type, int index, Object object, int repeat, - Object previous, ObservableCollection range, int rangeOffset) { + Object previous, ObservableCollection view, int viewOffset) { if ((postMask & type) > 0) { StandardPostModificationEvent event = null; @@ -523,7 +523,7 @@ public class StandardModificationHandler extends ModificationHandler { if (event == null) { event = new StandardPostModificationEvent( getObservedCollection(), this, type, preSize, index, - object, repeat, previous, range, rangeOffset); + object, repeat, previous, view, viewOffset); } holder.listener.modificationOccurred(event); } diff --git a/src/java/org/apache/commons/collections/observed/standard/StandardPostModificationEvent.java b/src/java/org/apache/commons/collections/observed/standard/StandardPostModificationEvent.java index 7d9cb6930..a13719f76 100644 --- a/src/java/org/apache/commons/collections/observed/standard/StandardPostModificationEvent.java +++ b/src/java/org/apache/commons/collections/observed/standard/StandardPostModificationEvent.java @@ -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.4 2003/09/21 16:00:28 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.5 2003/09/21 20:00:29 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -70,7 +70,7 @@ import org.apache.commons.collections.observed.ObservableCollection; * All objects used are the real objects from the method calls, not clones. * * @since Commons Collections 3.0 - * @version $Revision: 1.4 $ $Date: 2003/09/21 16:00:28 $ + * @version $Revision: 1.5 $ $Date: 2003/09/21 20:00:29 $ * * @author Stephen Colebourne */ @@ -92,8 +92,8 @@ public class StandardPostModificationEvent extends StandardModificationEvent { * @param object the value that changed * @param repeat the number of repeats * @param previous the previous value being removed/replaced - * @param range the range collection, null if no range - * @param rangeOffset the offset of the range, -1 if unknown + * @param view the view collection, null if event from main collection + * @param viewOffset the offset within the main collection of the view, -1 if unknown */ public StandardPostModificationEvent( final ObservableCollection obsCollection, @@ -104,11 +104,11 @@ public class StandardPostModificationEvent extends StandardModificationEvent { final Object object, final int repeat, final Object previous, - final ObservableCollection range, - final int rangeOffset) { + final ObservableCollection view, + final int viewOffset) { super(obsCollection, handler, type, preSize, index, - object, repeat, previous, range, rangeOffset); + object, repeat, previous, view, viewOffset); postSize = collection.size(); } diff --git a/src/java/org/apache/commons/collections/observed/standard/StandardPreModificationEvent.java b/src/java/org/apache/commons/collections/observed/standard/StandardPreModificationEvent.java index 38b6f3454..b9bd66e40 100644 --- a/src/java/org/apache/commons/collections/observed/standard/StandardPreModificationEvent.java +++ b/src/java/org/apache/commons/collections/observed/standard/StandardPreModificationEvent.java @@ -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.4 2003/09/21 16:00:28 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.5 2003/09/21 20:00:29 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -70,7 +70,7 @@ import org.apache.commons.collections.observed.ObservableCollection; * All objects used are the real objects from the method calls, not clones. * * @since Commons Collections 3.0 - * @version $Revision: 1.4 $ $Date: 2003/09/21 16:00:28 $ + * @version $Revision: 1.5 $ $Date: 2003/09/21 20:00:29 $ * * @author Stephen Colebourne */ @@ -89,6 +89,8 @@ public class StandardPreModificationEvent extends StandardModificationEvent { * @param object the value that changed * @param repeat the number of repeats * @param previous the previous value being removed/replaced + * @param view the view collection, null if event from main collection + * @param viewOffset the offset within the main collection of the view, -1 if unknown */ public StandardPreModificationEvent( final ObservableCollection obsCollection, @@ -99,11 +101,11 @@ public class StandardPreModificationEvent extends StandardModificationEvent { final Object object, final int repeat, final Object previous, - final ObservableCollection range, - final int rangeOffset) { + final ObservableCollection view, + final int viewOffset) { super(obsCollection, handler, type, preSize, index, - object, repeat, previous, range, rangeOffset); + object, repeat, previous, view, viewOffset); } }