|
||||||||||
| 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.UniqueResultStructure<R>
public class UniqueResultStructure<R>
UniqueResultStructures are the leaves in the tree of nested
SearchStructures. Each UniqueResultStructure defines a result of
a search. It is designed to hold exactly one value, in contrast to ResultStructures. Because of this UniqueResultStructures throw an
UnsupportedOperationException when trying to merge them. The benefit is that setting up a
SearchStructure with ambiguous results provokes an exception, even before it is put to
use.
| Method Summary | ||
|---|---|---|
UniqueResultStructure<R> |
copy()
This method copies the object which calls it. |
|
static
|
createWith(R resultValue)
Creates a new ResultSet with the given resultValue as its only result value. |
|
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. |
|
R |
getUnique()
Returns the value if there is exactly one value. |
|
R |
getUnique(R defaultValue)
Returns the value if there is exactly one value or the given defaultValue if this structure is empty. |
|
int |
hashCode()
|
|
void |
merge(UniqueResultStructure<R> otherStructure)
Merging adds the contents of the otherMergable to this object. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <R> UniqueResultStructure<R> createWith(R resultValue)
ResultSet with the given resultValue as its only result value. The
resultValue must not be null.
public SearchStructure<R> get(Object key)
SearchStructureSearchStructure 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.
get in class SearchStructure<R>key - The key for the requested nested SearchStructure
SearchStructure or an EmptySearchStructure if the key does
not exist.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>SearchStructurepublic void merge(UniqueResultStructure<R> otherStructure)
MergeAndCopyStructureSearchStructure
deletes no content, instead equal values are being merged recursively.
merge in interface MergeAndCopyStructure<UniqueResultStructure<R>>otherStructure - The object that should be merged into this objectpublic R getUnique(R defaultValue)
SearchStructure
Use this method if you know there should be at most one result value. This method throws an
AssertionError if there is more than one value.
getUnique in class SearchStructure<R>defaultValue - The defaultValue which is returned if this SearchStructure is
empty.
SearchStructure or the defaultValue if the structure
is empty.public R getUnique()
SearchStructure
Use this method if you know there should be exactly one result value. This method throws an
AssertionError if there is more than one values. If there is no value it throws an
NoSuchElementException exception.
getUnique in class SearchStructure<R>SearchStructure.public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic String toString()
toString in class Objectpublic UniqueResultStructure<R> copy()
MergeAndCopyStructure.copy().
The UniqueResultStructure is immutable. Hence it is not needed to create a copy.
copy in interface MergeAndCopyStructure<UniqueResultStructure<R>>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||