You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2003/09/21 22:00:29 UTC

cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/observed/standard StandardPostModificationEvent.java StandardModificationHandler.java StandardPreModificationEvent.java StandardModificationEvent.java

scolebourne    2003/09/21 13:00:29

  Modified:    collections/src/java/org/apache/commons/collections/observed/standard
                        StandardPostModificationEvent.java
                        StandardModificationHandler.java
                        StandardPreModificationEvent.java
                        StandardModificationEvent.java
  Log:
  Rename range to view
  
  Revision  Changes    Path
  1.5       +7 -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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardPostModificationEvent.java	21 Sep 2003 16:00:28 -0000	1.4
  +++ StandardPostModificationEvent.java	21 Sep 2003 20:00:29 -0000	1.5
  @@ -92,8 +92,8 @@
        * @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 @@
           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();
       }
   
  
  
  
  1.6       +22 -22    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StandardModificationHandler.java	21 Sep 2003 16:00:28 -0000	1.5
  +++ StandardModificationHandler.java	21 Sep 2003 20:00:29 -0000	1.6
  @@ -429,16 +429,16 @@
        * @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 @@
        * @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 @@
                           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 @@
        * @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 @@
        * 
        * @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 @@
                           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);
                       }
  
  
  
  1.5       +7 -5      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardPreModificationEvent.java	21 Sep 2003 16:00:28 -0000	1.4
  +++ StandardPreModificationEvent.java	21 Sep 2003 20:00:29 -0000	1.5
  @@ -89,6 +89,8 @@
        * @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 @@
           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);
       }
   
   }
  
  
  
  1.7       +29 -25    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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StandardModificationEvent.java	21 Sep 2003 16:00:28 -0000	1.6
  +++ StandardModificationEvent.java	21 Sep 2003 20:00:29 -0000	1.7
  @@ -96,10 +96,10 @@
       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 @@
        * @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 @@
           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 @@
           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 @@
           return preSize;
       }
   
  -    // Range info
  +    // View info
       //-----------------------------------------------------------------------
       /**
  -     * Gets the range, <code>null</code> if none.
  +     * Gets the view, <code>null</code> if none.
  +     * <p>
  +     * 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, <code>-1</code> if no range or unknown offset.
  +     * Gets the view offset, <code>-1</code> if no view or unknown offset.
  +     * <p>
  +     * 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