Interface Container

All Superinterfaces:
All Known Subinterfaces:
BinaryTree, CircularSequence, Dictionary, EmbeddedPlanarGraph, Graph, KeyBasedContainer, ModifiableGraph, OrderedDictionary, OrderedGraph, PositionalContainer, PriorityQueue, Sequence, Tree

public interface Container
extends InspectableContainer

The common interface for all the mutable containers in JDSL. A container is a collection of elements, each of which is a generic Object. An element can be stored multiple times in a container. All containers organize a client's data elements, and the methods defined in this interface are those that any container should be able to perform on the data that it is organizing and storing. This class is distinct from the class java.awt.Container; therefore, if you are importing both packages, you must refer to it by its fully qualified name.

$Id: Container.java,v 1.8 2000/07/18 16:09:55 lv Exp $
Mark Handy (mdh), Andrew Schwerin (schwerin), Michael T. Goodrich, Roberto Tamassia, Luca Vismara (lv)
See Also:

Method Summary
 Container newContainer()
          Creates a new, empty container of the same class as this one (and therefore of the same interface as this one).
 java.lang.Object replaceElement(Accessor a, java.lang.Object newElement)
          Changes the element stored at an accessor.
Methods inherited from interface jdsl.core.api.InspectableContainer
contains, elements, isEmpty, size

Method Detail


public Container newContainer()
Creates a new, empty container of the same class as this one (and therefore of the same interface as this one). That is, if newContainer() is called on a NodeSequence, the Container that is returned is actually a NodeSequence. This is a use of the Factory Method design pattern.
A new, empty Container of the same class as this one.


public java.lang.Object replaceElement(Accessor a,
                                       java.lang.Object newElement)
                                throws InvalidAccessorException
Changes the element stored at an accessor.
a - Accessor in this container
newElement - to be stored at a
old element, previously stored at a
InvalidAccessorException - if a is null or does not belong to this container