jdsl.core.api
Interface Container
- All Superinterfaces:
- InspectableContainer
- All Known Subinterfaces:
- BinaryTree, Dictionary, Graph, KeyBasedContainer, ModifiableGraph, OrderedDictionary, 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.
- Version:
- JDSL 2.0.6
- Author:
- Mark Handy (mdh), Andrew Schwerin (schwerin), Michael T. Goodrich, Roberto Tamassia, Luca Vismara (lv)
- See Also:
InspectableContainer
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. |
newContainer
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.
- Returns:
- A new, empty Container of the same class as this one.
replaceElement
public java.lang.Object replaceElement(Accessor a,
java.lang.Object newElement)
throws InvalidAccessorException
- Changes the element stored at an accessor.
- Parameters:
a
- Accessor in this containernewElement
- to be stored at a- Returns:
- old element, previously stored at a
- Throws:
InvalidAccessorException
- if a is null or does not
belong to this container