Index: java/org/apache/commons/collections/Bag.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/collections/Bag.java,v
retrieving revision 1.5
diff -r1.5 Bag.java
74a75,76
>  * @author Paul Jack
>  * @version $Id$
89,90c91
<     * @return <code>true</code> if the object was not already in the
<     *         <code>uniqueSet</code>
---
>     * @return <code>true</code>, always
98,99c99,100
<     * @return <code>true</code> if the object was not already in the
<     *         <code>uniqueSet</code>
---
>     * @return <code>true</code>, always
>     * @throws IllegalArgumentException if <code>i</Code> is nonpositive
106,107c107,109
<     * Remove all occurrences of the given object from the bag, and do
<     * not represent the object in the {@link #uniqueSet()}.
---
>     * Removes one occurrence of the given object from the bag.  If there
>     * is only one occurrence, the object will no longer appear in the
>     * {@link uniqueSet()}.
119a122
>     * @throws IllegalArgumentException if <code>i</code> is nonpositive
126c129,130
<     * Set}.
---
>     * Set}.  The returned set is unmodifiable.
>     * @return this bag's unique set
131a136
>     * @return this bag's size
136,140c141,145
<     * Returns <code>true</code> if the bag contains all elements in
<     * the given collection, respecting cardinality.  That is, if the
<     * given collection <code>C</code> contains <code>n</code> copies
<     * of a given object, calling {@link #getCount(Object)} on that object must
<     * be <code>&gt;= n</code> for all <code>n</code> in <code>C</code>.
---
>     * Returns <code>true</code> if the bag contains at least one occurence
>     * of all unique elements in the given collection.
>     * @return <code>true</code> if this bag contains all the given 
>     *   collection's elements
>     * @throws NullPointerException if the given collection is null
145,149c150,152
<     * Remove all elements represented in the given collection,
<     * respecting cardinality.  That is, if the given collection
<     * <code>C</code> contains <code>n</code> copies of a given object,
<     * the bag will have <code>n</code> fewer copies, assuming the bag
<     * had at least <code>n</code> copies to begin with.
---
>     * Remove all elements represented in the given collection.
>     * All occurrences of all elements in the given collection will be
>     * removed.
150a154
>     * @throws NullPointerException if the given collection is null
156,162c160,161
<     * collection, respecting cardinality.  That is, if the given
<     * collection <code>C</code> contains <code>n</code> copies of a
<     * given object and the bag has <code>m &gt; n</code> copies, then
<     * delete <code>m - n</code> copies from the bag.  In addition, if
<     * <code>e</code> is an object in the bag but
<     * <code>!C.contains(e)</code>, then remove <code>e</code> and any
<     * of its copies.
---
>     * collection.  All occurrences of any element contained in the given 
>     * collection will remain in the bag.
164a164
>     * @throws NullPointerException if the given collection is null
Index: java/org/apache/commons/collections/DefaultMapBag.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/collections/DefaultMapBag.java,v
retrieving revision 1.1
diff -r1.1 DefaultMapBag.java
95,101c95,97
<       if (i > 0) {
<          int count = (i + getCount(o));
<          _map.put(o, new Integer(count));
<          _total += i;
<          return (count == i);
<       } else {
<          return false;
---
>       if (i <= 0) {
>          throw new IllegalArgumentException("Number of occurrences to " +
>           "add must be positive.");
102a99,102
>       int count = (i + getCount(o));
>       _map.put(o, new Integer(count));
>       _total += i;
>       return true;
106d105
<       boolean changed = false;
109,110c108
<          boolean added = add(i.next());
<          changed = changed || added;
---
>          add(i.next());
112c110
<       return changed;
---
>       return true;
126c124
<       return containsAll(new HashBag(c));
---
>       return _map.keySet().containsAll(c);
200c198
<       return remove(o, getCount(o));
---
>       return remove(o, 1);
204a203,206
>       if (i <= 0) {
>          throw new IllegalArgumentException("Number of occurrences to " +
>           "remove must be positive.");
>       }
207,209c209
<       if (i <= 0) {
<          result = false;
<       } else if (count > i) {
---
>       if (count > i) {
223,228c223,230
<       if (c != null) {
<          Iterator i = c.iterator();
<          while (i.hasNext()) {
<             boolean changed = remove(i.next(), 1);
<             result = result || changed;
<          }
---
>       Iterator i = c.iterator();
>       while (i.hasNext()) {
>           Object element = i.next();
>           int count = getCount(element);
>           if (count > 0) {
>              remove(element, count);
>              result = true;
>           }
234c236,248
<       return retainAll(new HashBag(c));
---
>       boolean result = false;
>       Iterator iterator = _map.keySet().iterator();
>       while (iterator.hasNext()) {
>          Object element = iterator.next();
>          if (!c.contains(element)) {
>             int count = getCount(element);
>             iterator.remove();
>             _total -= count;
>             _mods++;
>             result = true;
>          }
>       }
>       return result;
Index: test/org/apache/commons/collections/TestBag.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/collections/src/test/org/apache/commons/collections/TestBag.java,v
retrieving revision 1.3
diff -r1.3 TestBag.java
135c135,139
<       bag.remove("A", 0);
---
>       try {
>          bag.remove("A", 0);
>          fail("remove(e,0) should raise IllegalArgument");
>       } catch (IllegalArgumentException e) {
>       }
140c144
<       assertEquals("Should have count of 0", 0, bag.getCount("A"));
---
>       assertEquals("Should have count of 1", 1, bag.getCount("A"));
154c158
<       assertEquals("Should have count of 1", 1, bag.getCount("A"));
---
>       assertEquals("Should have count of 0", 0, bag.getCount("A"));
157c161
<       assertEquals("Should have count of 2", 2, bag.size());
---
>       assertEquals("Should have count of 1", 1, bag.size());
185c189
<       assertTrue("Bag contains items in the list", !bag.containsAll(compare));
---
>       assertTrue("Bag contains items in the list", bag.containsAll(compare));
200c204
<       assertEquals("Should have 1 total item", 1, bag.size());
---
>       assertEquals("Should have 2 total item", 2, bag.size());
215c219
<       assertEquals("Should have 2 total items", 2, bag.size());
---
>       assertEquals("Should have 3 total items", 3, bag.size());

