|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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(Object key,
Object element)
Inserts a (key,element) pair into this container. |
void |
remove(Locator loc)
Removes a (key,element) pair from the container. |
Object |
replaceKey(Locator loc,
Object key)
Replaces the key in the given (key,element) pair, adjusting the container as necessary. |
Methods inherited from interface jdsl.core.api.InspectableKeyBasedContainer |
keys, locators |
Methods inherited from interface jdsl.core.api.InspectableContainer |
contains, elements, isEmpty, size |
Methods inherited from interface jdsl.core.api.Container |
newContainer, replaceElement |
Method Detail |
public Locator insert(Object key, 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 containerpublic void 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 containerpublic Object replaceKey(Locator loc, 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 |