Container is the abstract superpattern for all patterns in the container libraries, defining all common attributes of container patterns.
Container patterns are generic patterns in the sense that the element type of the elements kept in the container is specified through the element virtual attribute.
Container defines the following additional attributes:
Container also defines two exceptions:
- init: To be invoked before the container object may be used.
- clear: empties the container.
- empty: returns true, if the container does not contain any elements.
- size: returns the number of elements in the container.
- capacity: returns the current capacity of the container. Most containers will dynamically expand as usage demands, and capacity returns the current capacity (subject to changes later, when usage demands). If the capacity of the container is in principle indefinite, capacity returns -1.
- has: takes a reference to an element object, and returns true if the element is in the container.
- scan: scans through the entire container, invoking INNER for each element in the container satisfying a predicate.
- find: scans through the entire container, invoking INNER first time an element is found, satisfying a predicate. Find also returns a reference to the element found.
- copy: creates an exact copy of the container. Only elements satisfying a predicate is copied to the new container.
- equal: a virtual procedure pattern, taking two element references. Equal returns true is the two element references are identical. Equal is used in the implementation of the above operations (and some of the later mentioned operations). If some other equality test is wanted for specific containers, this can be accomplished by further binding equal in that container.
- emptyContainerError: is invoked if the container is empty, and some container operation is invoked which demands a non empty container.
- illegalCellReference: is invoked, if some container operation is making illegal references internally in the container private data structures.
|Container Libraries - Reference Manual
||© 1992-2002 Mjølner Informatics
[Modified: Thursday October 19th 2000 at 12:51]