Interface Indexer<Tuple_ extends Tuple,​Value_>

  • Type Parameters:
    Tuple_ - For example for from(A).join(B), the tuple is UniTuple<A> xor UniTuple<B>. For example for Bi<A, B>.join(C), the tuple is BiTuple<A, B> xor UniTuple<C>.
    Value_ - For example for from(A).join(B), the value is Set<BiTuple<A, B>>. For example for Bi<A, B>.join(C), the value is Set<TriTuple<A, B, C>>.

    public interface Indexer<Tuple_ extends Tuple,​Value_>
    An indexer for entity or fact X, maps a property or a combination of properties of X, denoted by indexProperties, to all instances of X that match those properties, depending on the the indexer type (equal, lower than, ...). For example for {Lesson(id=1, room=A), Lesson(id=2, room=B), Lesson(id=3, room=A)}, calling get(room=A) would return a map with a keySet of lesson 1 and 3.

    It returns a Map<X, V> instead of Set<X> for performance, to avoid doing the same hash lookup twice in the client. For example AbstractJoinNode uses the value to store a set of child tuples justified by the X instance.

    The fact X is wrapped in a Tuple, because the BavetTupleState is needed by clients of #visit(IndexProperties, Consumer).