org.apache.commons.collections.bag

Class AbstractBagDecorator

Implemented Interfaces:
Bag, Collection
Known Direct Subclasses:
AbstractSortedBagDecorator, UnmodifiableBag

public abstract class AbstractBagDecorator
extends AbstractCollectionDecorator
implements Bag

Decorates another Bag to provide additional behaviour.

Methods are forwarded directly to the decorated bag.

Version:
$Revision: 1.5 $ $Date: 2004/06/02 21:53:02 $
Author:
Stephen Colebourne
Since:
Commons Collections 3.0

Field Summary

Fields inherited from class org.apache.commons.collections.collection.AbstractCollectionDecorator

collection

Constructor Summary

AbstractBagDecorator()
Constructor only used in deserialization, do not use otherwise.
AbstractBagDecorator(Bag bag)
Constructor that wraps (not copies).

Method Summary

boolean
add(Object object, int count)
protected Bag
getBag()
Gets the bag being decorated.
int
getCount(Object object)
boolean
remove(Object object, int count)
Set
uniqueSet()

Methods inherited from class org.apache.commons.collections.collection.AbstractCollectionDecorator

add, addAll, clear, contains, containsAll, equals, getCollection, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString

Constructor Details

AbstractBagDecorator

protected AbstractBagDecorator()
Constructor only used in deserialization, do not use otherwise.
Since:
Commons Collections 3.1

AbstractBagDecorator

protected AbstractBagDecorator(Bag bag)
Constructor that wraps (not copies).
Parameters:
bag - the bag to decorate, must not be null

Method Details

add

public boolean add(Object object,
                   int count)
Specified by:
add in interface Bag

getBag

protected Bag getBag()
Gets the bag being decorated.
Returns:
the decorated bag

getCount

public int getCount(Object object)
Specified by:
getCount in interface Bag

remove

public boolean remove(Object object,
                      int count)
Specified by:
remove in interface Bag

uniqueSet

public Set uniqueSet()
Specified by:
uniqueSet in interface Bag

Copyright © 2001-2006 Apache Software Foundation. All Rights Reserved.