org.faktorips.runtime.internal.tableindex
Class ResultStructure<R>

java.lang.Object
  extended by org.faktorips.runtime.internal.tableindex.SearchStructure<R>
      extended by org.faktorips.runtime.internal.tableindex.ResultStructure<R>
All Implemented Interfaces:
MergeAndCopyStructure<ResultStructure<R>>

public class ResultStructure<R>
extends SearchStructure<R>
implements MergeAndCopyStructure<ResultStructure<R>>

ResultStructures are the leaves in the tree of nested SearchStructures. Each ResultStructure defines a result of a search and thus holds a set of values. It also implements the MergeAndCopyStructure interface to be able to combine the values of two result structures.


Method Summary
 ResultStructure<R> copy()
          This method copies the object which calls it.
static
<R> ResultStructure<R>
createWith(R resultValue)
          Creates a new ResultSet with the given resultValue as its only result value.
static
<R> ResultStructure<R>
createWith(Set<R> resultValues)
          Creates a new ResultSet with the given set of result values.
 boolean equals(Object obj)
           
 Set<R> get()
          Returns the set of resulting values.
 SearchStructure<R> get(Object key)
          Returns the nested SearchStructure for the given key.
 int hashCode()
           
 void merge(ResultStructure<R> otherStructure)
          Merging adds the contents of the otherMergable to this object.
 String toString()
           
 
Methods inherited from class org.faktorips.runtime.internal.tableindex.SearchStructure
getUnique, getUnique
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createWith

public static <R> ResultStructure<R> createWith(R resultValue)
Creates a new ResultSet with the given resultValue as its only result value.


createWith

public static <R> ResultStructure<R> createWith(Set<R> resultValues)
Creates a new ResultSet with the given set of result values.


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.

get

public Set<R> get()
Description copied from class: SearchStructure
Returns the set of resulting values. If this SearchStructure is no ResultStructure this method simply aggregates every nested structures' results. Beware that the aggregation of nested elements has linear complexity.

Specified by:
get in class SearchStructure<R>
Returns:
The set of resulting values that are reachable by this SearchStructure

merge

public void merge(ResultStructure<R> otherStructure)
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<ResultStructure<R>>
Parameters:
otherStructure - The object that should be merged into this object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

copy

public ResultStructure<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<ResultStructure<R>>
Returns:
T that is a copy of the calling object


Copyright © 2015. All rights reserved.