Implementing Bounded Collections

In the current implementation of the Collection Classes, all collections are unbounded. The concept of bounded collections is supported so that you can create your own bounded collection implementations. There are no bounded collections in the Collection Classes.

A bounded collection limits the number of elements it can contain. When a bounded collection contains the maximum number of elements (its bound), the collection is said to be full. This condition can be tested by the function isFull. If elements are added to a full collection, the exception IFullException is thrown. This behavior is useful for collections that are to have their storage allocated completely on the runtime stack.

You can determine the maximum number of elements in a bounded collection by calling the function maxNumberOfElements. You can only call this function if the collection is bounded. You can determine whether a collection is bounded by calling the function isBounded.

The functions isBounded and isFull always return false. The function maxNumberOfElements throws the exception INotBoundedException.



Introduction to the Collection Classes
Collection Class Hierarchy
Overall Implementation Structure
Collection Characteristics


Adding an Element to a Collection
Removing an Element from a Collection
Replacing the Default Implementation
Instantiating the Collection Classes