org.faktorips.runtime.internal.tableindex
Class KeyStructure<K,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R>

java.lang.Object
  extended by org.faktorips.runtime.internal.tableindex.SearchStructure<R>
      extended by org.faktorips.runtime.internal.tableindex.AbstractMapStructure<K,V,R>
          extended by org.faktorips.runtime.internal.tableindex.KeyStructure<K,V,R>
All Implemented Interfaces:
MergeAndCopyStructure<KeyStructure<K,V,R>>

public class KeyStructure<K,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R>
extends AbstractMapStructure<K,V,R>
implements MergeAndCopyStructure<KeyStructure<K,V,R>>

An implementation of AbstractMapStructure mapping keys to nested SearchStructures much like a map. This structure is useful for values that can be identified by their key. The generic types are described in AbstractMapStructure.

See Also:
AbstractMapStructure

Method Summary
 KeyStructure<K,V,R> copy()
          This method copies the object which calls it.
static
<K,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R>
KeyStructure<K,V,R>
create()
          Creates a new empty KeyStructure.
static
<K,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R>
KeyStructure<K,V,R>
createWith(K key, V value)
          Creates a new KeyStructure and put the given key value pair.
 SearchStructure<R> get(Object key)
          Returns the nested SearchStructure for the given key.
 void merge(KeyStructure<K,V,R> map)
          Merging adds the contents of the otherMergable to this object.
 
Methods inherited from class org.faktorips.runtime.internal.tableindex.AbstractMapStructure
emptyResult, fillCopy, get, getMap, getValidResult, merge, put
 
Methods inherited from class org.faktorips.runtime.internal.tableindex.SearchStructure
getUnique, getUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static <K,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R> KeyStructure<K,V,R> create()
Creates a new empty KeyStructure.


createWith

public static <K,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R> KeyStructure<K,V,R> createWith(K key,
                                                                                                          V value)
Creates a new KeyStructure and put the given key value pair.


get

public SearchStructure<R> get(Object key)
Description copied from class: SearchStructure
Returns the nested SearchStructure for the given key. This method never returns null. If no value exists for a given key an EmptySearchStructure is returned as a fall-back.

Specified by:
get in class SearchStructure<R>
Parameters:
key - The key for the requested nested SearchStructure
Returns:
The nested SearchStructure or an EmptySearchStructure if the key does not exist.

merge

public void merge(KeyStructure<K,V,R> map)
Description copied from interface: MergeAndCopyStructure
Merging adds the contents of the otherMergable to this object. This object then contains the combined content. The other object remains unchanged.Merging a SearchStructure deletes no content, instead equal values are being merged recursively.

Specified by:
merge in interface MergeAndCopyStructure<KeyStructure<K,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R>>
Parameters:
map - The object that should be merged into this object

copy

public KeyStructure<K,V,R> copy()
Description copied from interface: MergeAndCopyStructure
This method copies the object which calls it. The newly created object has the same properties like the object calling MergeAndCopyStructure.copy().

Specified by:
copy in interface MergeAndCopyStructure<KeyStructure<K,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R>>
Returns:
T that is a copy of the calling object


Copyright © 2015. All rights reserved.