Class TwoColumnRangeStructure<K extends Comparable<? super K>,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R>

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

public class TwoColumnRangeStructure<K extends Comparable<? super K>,V extends SearchStructure<R> & MergeAndCopyStructure<V>,R> extends AbstractMapStructure<org.faktorips.runtime.internal.tableindex.TwoColumnRange<K>,V,R> implements MergeAndCopyStructure<TwoColumnRangeStructure<K,V,R>>
A SearchStructure that maps ranges (keys) to nested SearchStructures i.e. sets of values. Each range in a TwoColumnRangeStructure is defined by lower and upper bound. Thus there might be "gaps" in between ranges, in contrast to RangeStructures. The TwoColumnRangeStructure also supports overlapping ranges, as well as "infinite" ranges.

Ranges are set up by putting one or more key-key-value tuples into this structure. The keys are of a comparable data type (of course, as they define a range). The value is a nested SearchStructure. The first key defines the lower bound, the second the upper bound of the range. The value can be retrieved by calling get(Object) with a key inside the defined range.

Example: In a TwoColumnRangeStructure by calling put(10, 24, "AAA") and put(25, 50, "BBB"), two ranges are defined. Calls to get(Object) with the:

  • keys 10, 24 and all in between will yield {"AAA"} as a result
  • keys 25, 50 and all in between will yield {"BBB"} respectively
  • keys outside these ranges, e.g. 0 or 100 will return an EmptySearchStructure.

Overlapping ranges: In a TwoColumnRangeStructure by calling put(0, 100, "AAA") and put(50, 200, "BBB"), two ranges are defined. Calls to get(Object) with keys:

  • keys 0, 49 and all in between will yield {"AAA"} as a result
  • keys 101, 200 and all in between will yield {"BBB"} respectively
  • keys in the overlapping, 50, 100 and all in between, will yield the set union {"AAA", "BBB"} as a result
  • keys outside these ranges, e.g. -100 or 500 will return an EmptySearchStructure.

Calling put(null, 100, "AAA") defines a range from negative infinity to 100, that maps to {"AAA"}. This range includes all values less than and equal to 100. Calling put(0, null, "BBB") in turn defines a range from 0 to positive infinity. This range includes all values greater than and equal to 0.