Class AbstractPositionalContainer

All Implemented Interfaces:
Container, InspectableContainer, InspectablePositionalContainer, PositionalContainer
Direct Known Subclasses:
AbstractCircularSequence, AbstractGraph, ArraySequence, NodeBinaryTree, NodeSequence, NodeTree

public abstract class AbstractPositionalContainer
extends java.lang.Object
implements PositionalContainer

An abstract positional container that others may extend if they do not wish to deal with some of the more mundane aspects of positional containers and/or if they wish to avoid implementing themselves some of the methods of container that aren't terribly pertinent to a PositionalContainer. Feel free to override any of these methods in subclasses, but be certain that they work according to the API in jdsl.core.api. Also handles isEmpty() from InspectableContainer.

$Id: AbstractPositionalContainer.java,v 1.12 2001/03/21 17:16:20 lv Exp $
Andrew Schwerin (schwerin), Benoit Hudson (bh), Ryan Shaun Baker (rsb)
See Also:

Constructor Summary
Method Summary
 boolean isEmpty()
          Checks if this container is empty.
 void swapElements(Position a, Position b)
          Works on top of PositionalContainer method replaceElement(Position, Object) and InspectableContainer method contains().
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jdsl.core.api.InspectablePositionalContainer
Methods inherited from interface jdsl.core.api.InspectableContainer
contains, elements, size
Methods inherited from interface jdsl.core.api.Container
newContainer, replaceElement

Constructor Detail


public AbstractPositionalContainer()
Method Detail


public void swapElements(Position a,
                         Position b)
                  throws InvalidAccessorException
Works on top of PositionalContainer method replaceElement(Position, Object) and InspectableContainer method contains().
Specified by:
swapElements in interface PositionalContainer
Following copied from interface: jdsl.core.api.PositionalContainer
a - First Position to swap
b - Second Position to swap
InvalidAccessorException - if either of a and b is null or does not belong to this positional container


public boolean isEmpty()
Checks if this container is empty. Has the same time complexity as size(). If size() is O(n) and you can write isEmpty() in O(1) time, then override this method.
Specified by:
isEmpty in interface InspectableContainer
Following copied from interface: jdsl.core.api.InspectableContainer
true if and only if the container is empty (holds no elements)
See Also: