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<? super T,S> matcher)
Finds the first element in the chain that satisfies the provided
Matcher. |
<S extends T> |
getCreate(Matcher<? super 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<? super 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<? super 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.find in interface Chain<T extends ModifiableLink<T>>S - the output type of the Matchermatcher - the object describing an element to search forMatcher or null if no such element is foundpublic <S extends T> S getCreate(Matcher<? super 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>>S - the output type of the Matchermatcher - 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<? super T,S> matcher)
ChainMatcher. If such element is found, the chain is modified.public 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.K - the types of the keys of the MapT - the types of the values of the Map and the elements of
the resulting Chainmap - the Map that backs the datakey - the key for which to return the Chain view of the dataChain view of the data associated with key in mapCopyright © 2011–2024 Live Ontologies Project. All rights reserved.