Class IndexerFactory<Right_>

java.lang.Object
ai.timefold.solver.core.impl.bavet.common.index.IndexerFactory<Right_>
Type Parameters:
Right_ -

public final class IndexerFactory<Right_> extends Object
Indexers form a parent-child hierarchy, each child has exactly one parent. NoneIndexer is always at the bottom of the hierarchy, never a parent unless it is the only indexer. Parent indexers delegate to their children, until they reach the ultimate NoneIndexer.

Example 1: EQUAL+LESS_THAN joiner will become EqualsIndexer -> ComparisonIndexer -> NoneIndexer.

Indexers have an id, which is the position of the indexer in the chain. Top-most indexer has id 0, and the id increases as we go down the hierarchy. Each tuple is assigned an IndexKeys instance, which determines its location in the index. IndexKeys instances are built from joiners using methods such as buildUniLeftKeysExtractor() and buildRightKeysExtractor(). Each index keyFunction has an id, and this id matches the id of the indexer; each keyFunction in IndexKeys is associated with a single indexer.

Comparison joiners result in a single indexer each, whereas equal joiners will be merged into a single indexer if they are consecutive. In the latter case, a composite keyFunction is created of type Pair, TriTuple, Quadruple or IndexerKey, based on the length of the composite keyFunction (number of equals joiners in sequence).

  • Example 2: For an EQUAL+LESS_THAN joiner, there are two indexers in the chain with keyFunction length of 1 each.
  • Example 3: For an LESS_THAN+EQUAL+EQUAL joiner, there are still two indexers, but the second indexer's keyFunction length is 2.
  • Example 4: For an LESS_THAN+EQUAL+EQUAL+LESS_THAN joiner, there are three indexers in the chain, and the middle one's keyFunction length is 2.