You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/09/15 07:53:58 UTC

svn commit: r815011 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java

Author: bayard
Date: Tue Sep 15 05:53:58 2009
New Revision: 815011

URL: http://svn.apache.org/viewvc?rev=815011&view=rev
Log:
Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.

Also see the following revisions:

    ------------------------------------------------------------------------
    r555925 | skestle | 2007-07-13 03:39:24 -0700 (Fri, 13 Jul 2007) | 2 lines
    
    Added Edwin Tellman's patch for COLLECTIONS-243.  
    It all seems pretty reasonable, and it should all be checked again as the project is worked through
    ------------------------------------------------------------------------
    r471201 | scolebourne | 2006-11-04 06:17:26 -0800 (Sat, 04 Nov 2006) | 1 line
    
    Remove getBag() - use covariant decorated()
    ------------------------------------------------------------------------

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java?rev=815011&r1=815010&r2=815011&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java Tue Sep 15 05:53:58 2009
@@ -31,8 +31,11 @@
  *
  * @author Stephen Colebourne
  */
-public abstract class AbstractBagDecorator
-        extends AbstractCollectionDecorator implements Bag {
+public abstract class AbstractBagDecorator<E>
+        extends AbstractCollectionDecorator<E> implements Bag<E> {
+
+    /** Serialization version */
+    private static final long serialVersionUID = -3768146017343785417L;
 
     /**
      * Constructor only used in deserialization, do not use otherwise.
@@ -48,7 +51,7 @@
      * @param bag  the bag to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    protected AbstractBagDecorator(Bag bag) {
+    protected AbstractBagDecorator(Bag<E> bag) {
         super(bag);
     }
 
@@ -57,25 +60,25 @@
      * 
      * @return the decorated bag
      */
-    protected Bag getBag() {
-        return (Bag) getCollection();
+    protected Bag<E> decorated() {
+        return (Bag<E>) super.decorated();
     }
 
     //-----------------------------------------------------------------------
     public int getCount(Object object) {
-        return getBag().getCount(object);
+        return decorated().getCount(object);
     }
 
-    public boolean add(Object object, int count) {
-        return getBag().add(object, count);
+    public boolean add(E object, int count) {
+        return decorated().add(object, count);
     }
 
     public boolean remove(Object object, int count) {
-        return getBag().remove(object, count);
+        return decorated().remove(object, count);
     }
 
-    public Set uniqueSet() {
-        return getBag().uniqueSet();
+    public Set<E> uniqueSet() {
+        return decorated().uniqueSet();
     }
 
 }