|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.faktorips.runtime.internal.tableindex.SearchStructure<R>
org.faktorips.runtime.internal.tableindex.AbstractMapStructure<K,V,R>
K - The type of key in the underlying map - can be restricted in subclassesV - The type of values in the map. Values are nested structures
which must:
R as this AbstractMapStructure
MergeAndCopyStructure interface. The class definition
enforces the implementation of MergeAndCopyStructure without restricting the
type V to a specific SearchStructure. Therefore the mergable type is bound to
? super V . R - The type of the result values. The result type must be the same in every nested
structure.public abstract class AbstractMapStructure<K,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R>
Abstract implementation for all structures that map keys to nested
structures much like a map.
This class provides a put(Object, SearchStructure) method to add nested structures.
Adding multiple structures with the same key will result in those structures being merged. This
makes setting up nested map structures easy.
This abstract implementation makes no assumption about the underlying map implementation. The map
instance is provided by subclasses via the constructor. Thus the SearchStructure.get(Object) method
implementation must also be provided by subclasses using the chosen data structure.
| Constructor Summary | |
|---|---|
protected |
AbstractMapStructure(Map<K,V> map)
Creates a new AbstractMapStructure with the specified map instance. |
| Method Summary | ||
|---|---|---|
protected SearchStructure<R> |
emptyResult()
Simply returns an EmptySearchStructure. |
|
protected
|
fillCopy(T structure)
|
|
Set<R> |
get()
Returns the set of resulting values. |
|
protected Map<K,V> |
getMap()
|
|
protected SearchStructure<R> |
getValidResult(V result)
Checks whether the given result is null and returns a fall-back result (an empty
ResultStructure) in that case. |
|
protected void |
merge(AbstractMapStructure<K,V,R> otherMap)
|
|
void |
put(K key,
V value)
Puts a new element in the map. |
|
| Methods inherited from class org.faktorips.runtime.internal.tableindex.SearchStructure |
|---|
get, getUnique, getUnique |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractMapStructure(Map<K,V> map)
AbstractMapStructure with the specified map instance.
map - The map that should be used as underlying data structure.| Method Detail |
|---|
public void put(K key,
V value)
key - key that maps to the specified valuevalue - value to be associated with the specified key.Map.put(Object, Object),
merge(AbstractMapStructure)protected void merge(AbstractMapStructure<K,V,R> otherMap)
protected <T extends AbstractMapStructure<K,V,R>> T fillCopy(T structure)
public Set<R> get()
SearchStructureSearchStructure is no
ResultStructure this method simply aggregates every nested structures' results. Beware that the aggregation of nested elements has linear complexity.
get in class SearchStructure<R>SearchStructureprotected Map<K,V> getMap()
protected SearchStructure<R> getValidResult(V result)
null and returns a fall-back result (an empty
ResultStructure) in that case.
result - a valid result or null.
EmptySearchStructure if the given result is
null. Never returns null.protected SearchStructure<R> emptyResult()
EmptySearchStructure. This is the typesafe representation of
EMPTY.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||