From 1258f14c7acba0afd9ef7d978263c31339e29df0 Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Tue, 15 Sep 2009 05:53:58 +0000 Subject: [PATCH] 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() ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815011 13f79535-47bb-0310-9956-ffa450edef68 --- .../collections/bag/AbstractBagDecorator.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java b/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java index aac6cf0f1..96a743c82 100644 --- a/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java +++ b/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java @@ -31,8 +31,11 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator; * * @author Stephen Colebourne */ -public abstract class AbstractBagDecorator - extends AbstractCollectionDecorator implements Bag { +public abstract class AbstractBagDecorator + extends AbstractCollectionDecorator implements Bag { + + /** Serialization version */ + private static final long serialVersionUID = -3768146017343785417L; /** * Constructor only used in deserialization, do not use otherwise. @@ -48,7 +51,7 @@ public abstract class AbstractBagDecorator * @param bag the bag to decorate, must not be null * @throws IllegalArgumentException if list is null */ - protected AbstractBagDecorator(Bag bag) { + protected AbstractBagDecorator(Bag bag) { super(bag); } @@ -57,25 +60,25 @@ public abstract class AbstractBagDecorator * * @return the decorated bag */ - protected Bag getBag() { - return (Bag) getCollection(); + protected Bag decorated() { + return (Bag) 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 uniqueSet() { + return decorated().uniqueSet(); } }