T - The type of elements in the chain.public abstract class AbstractChain<T extends ModifiableLink<T>> extends Object implements Chain<T>
Chain interface
to minimize the effort required to implement this interface. Essentially, one
has to provide only the implementation of the Link interface.| Constructor and Description |
|---|
AbstractChain() |
| Modifier and Type | Method and Description |
|---|---|
<S extends T> |
find(Matcher<T,S> matcher)
Finds the first element in the chain that satisfies the provided
Matcher. |
<S extends T> |
getCreate(Matcher<T,S> matcher,
ReferenceFactory<T,S> factory)
Finds an element in the chain satisfies the provided
Matcher, or
if no such element is found, creates a new element using the provided
ReferenceFactory and inserts it into the chain. |
static <K,T extends ModifiableLink<T>> |
getMapBackedChain(Map<K,T> map,
K key)
|
<S extends T> |
remove(Matcher<T,S> matcher)
Removes the first element in the chain that satisfies the provided
Matcher. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnext, setNextpublic <S extends T> S find(Matcher<T,S> matcher)
ChainMatcher. This function does not modify the chain. If the chain is
modified during calling of this function, the behavior of the function is
not specified.public <S extends T> S getCreate(Matcher<T,S> matcher, ReferenceFactory<T,S> factory)
ChainMatcher, or
if no such element is found, creates a new element using the provided
ReferenceFactory and inserts it into the chain. In the letter
case, the chain is modified.getCreate in interface Chain<T extends ModifiableLink<T>>matcher - the object describing the element to search forfactory - the factory for creating referencesMatcher if found
in the chain, or the newly created and inserted element object
otherwisepublic <S extends T> S remove(Matcher<T,S> matcher)
ChainMatcher. If such element is found, the chain is modified.remove in interface Chain<T extends ModifiableLink<T>>matcher - the object describing the element to search fornull if not foundpublic static <K,T extends ModifiableLink<T>> Chain<T> getMapBackedChain(Map<K,T> map, K key)
Chain view of the value associated with the given key
in the given Map. The values of the map must be instances of the
type that can be used in the Chain interface. All operations with
the returned Chain, such as addition or removal, will be
reflected accordingly in the corresponding value in the Map.Copyright © 2011-2015 Department of Computer Science, University of Oxford. All Rights Reserved.