|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface KeyBasedContainer
Key-based containers are containers that store (key,element) pairs; each pair is represented by a Locator. The keys might or might not be ordered. The elements are entirely arbitrary, as far as the container is concerned. Attaching a key to every element allows the container to perform key-based retrievals of elements later.
Key-based containers allow duplicate keys, elements, or pairs, but there is a unique locator associated with each insertion of a pair. Users can implement no-duplicates semantics on top of key-based containers if required.
InspectableKeyBasedContainer
,
Container
,
Locator
Method Summary | |
---|---|
Locator |
insert(java.lang.Object key,
java.lang.Object element)
Inserts a (key,element) pair into this container. |
void |
remove(Locator loc)
Removes a (key,element) pair from the container. |
java.lang.Object |
replaceKey(Locator loc,
java.lang.Object key)
Replaces the key in the given (key,element) pair, adjusting the container as necessary. |
Methods inherited from interface nz.ac.waikato.jdsl.core.api.InspectableKeyBasedContainer |
---|
keys, locators |
Methods inherited from interface nz.ac.waikato.jdsl.core.api.Container |
---|
newContainer, replaceElement |
Methods inherited from interface nz.ac.waikato.jdsl.core.api.InspectableContainer |
---|
contains, elements, isEmpty, size |
Method Detail |
---|
Locator insert(java.lang.Object key, java.lang.Object element) throws InvalidKeyException
key
- the key associated with the specified element.element
- the element to insert into the container.
InvalidKeyException
- if key
cannot be used
by this containervoid remove(Locator loc) throws InvalidAccessorException
loc
- a locator in the container to remove
InvalidAccessorException
- if the locator is not valid or
is not contained by this containerjava.lang.Object replaceKey(Locator loc, java.lang.Object key) throws InvalidAccessorException, InvalidKeyException
loc
- the locator in the container whose key should be replacedkey
- the new key to associate with loc
.
InvalidAccessorException
- If the locator is not valid
or is not contained by this container
InvalidKeyException
- If key
cannot be used
by this container
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |