Release 2.1  Copyright ã1993-1994 by Lighthouse Design, Ltd.  All Rights Reserved.

FCBag

Inherits From:	FCUnorderedCollection : FCCollection : Object 

Declared In:	FCBag.h 

Class Description 

FCBag is a subclass of FCUnorderedCollection that implements the behavior of a bag. A bag is a unordered collection in which objects can appear multiple times. 

The advantage to an FCBag is that it doesn't actually store an object multiple times if you add it multiple times; FCBag merely increments a count for that object.  Thus, an FCBag is very efficient for storing objects that are duplicated many times.  For example, if you were counting the number of occurences of each unique word in a document, you could simply add all the words to an FCBag.  (That is, assuming you had a Word object, which would in reality be quite inefficient.) 

FCBag inherits from FCUnorderedCollection and FCCollection.  The interface documented here only covers the methods that are new or different in FCBag, but all the methods in FCCollection and FCUnorderedCollection will work on an FCBag as well.  Refer to the documentation on those classes to complete the description of an FCBag. 

Instance Variables 

Inherited from Object 
None declared in this class. 

Inherited from FCCollection 
id _fc_contents ; 
Class _fc_class ; 
SEL _fc_sortSelector ; 
BOOL _fc_archiveByReference ; 

Inherited from FCUnorderedCollection 
None declared in this class. 

Declared in FCBag 
None declared in this class. 

Method Types 

Modifying the Contents	-addObject:withOccurrences: 

Instance Methods 

addObject:withOccurrences: 
- addObject:anObject withOccurrences:(unsigned)n;
 
Adds anObject into the collection n more times.  If the object didn't exist in the collection, it will now occur n times, if it did exist m times, it will now exist n +m times. 

See also:   - addObject:  (FCCollection), - removeObject:  (FCCollection), - removeAllOccurrencesOfObject:  (FCCollection)