nz.ac.waikato.jdsl.core.api
Interface InspectableContainer
- All Known Subinterfaces:
- BinaryTree, Container, Dictionary, Graph, InspectableBinaryTree, InspectableDictionary, InspectableGraph, InspectableKeyBasedContainer, InspectableOrderedDictionary, InspectablePositionalContainer, InspectableSequence, InspectableTree, KeyBasedContainer, ModifiableGraph, OrderedDictionary, PositionalContainer, PriorityQueue, Sequence, Tree
- All Known Implementing Classes:
- AbstractGraph, AbstractPositionalContainer, ArrayHeap, ArraySequence, HashtableDictionary, IncidenceListGraph, NodeBinaryTree, NodeSequence, NodeTree, RedBlackTree
public interface InspectableContainer
A "read only" interface to a container; please see Container
for more details.
- Version:
- JDSL 2.1.1
- Author:
- Mark Handy (mdh), Andrew Schwerin (schwerin), Michael T. Goodrich, Roberto Tamassia, Luca Vismara (lv)
- See Also:
Container
Method Summary |
boolean |
contains(Accessor a)
Checks whether this container contains accessor a |
ObjectIterator |
elements()
Returns an iterator over all the elements stored in this
container. |
boolean |
isEmpty()
Checks whether this container holds zero elements. |
int |
size()
Gives the number of elements stored in the container. |
size
int size()
- Gives the number of elements stored in the container. If the
same element is stored in multiple places in the Container, it is
counted multiple times by size(). Might have time-complexity
O(N) for containers that are subject to split or splice
operations (like trees).
- Returns:
- Number of elements stored by the container.
isEmpty
boolean isEmpty()
- Checks whether this container holds zero elements. But isEmpty()
is guaranteed to take constant time, while size() can be O(n).
- Returns:
true
if and only if the container is empty (holds
no elements)- See Also:
InspectableBinaryTree
contains
boolean contains(Accessor a)
throws InvalidAccessorException
- Checks whether this container contains accessor
a
- Throws:
InvalidAccessorException
- if a is null
elements
ObjectIterator elements()
- Returns an iterator over all the elements stored in this
container. No order is guaranteed, although subinterfaces or
implementations may make a guarantee. The iterator returned is a
snapshot --
that is, it iterates over all objects that were elements of the container
at the moment that elements(.) was called, regardless of subsequent
modifications to the container.
- Returns:
- an iterator over all the elements stored in this
container
Copyright © 2009 ModelJUnit Project. All Rights Reserved.