Class AbstractConcatNode<LeftTuple_ extends AbstractTuple,RightTuple_ extends AbstractTuple,OutTuple_ extends AbstractTuple>

java.lang.Object
ai.timefold.solver.core.impl.bavet.common.AbstractNode
ai.timefold.solver.core.impl.bavet.common.AbstractTwoInputNode<LeftTuple_,RightTuple_>
ai.timefold.solver.core.impl.bavet.common.AbstractConcatNode<LeftTuple_,RightTuple_,OutTuple_>
All Implemented Interfaces:
LeftTupleLifecycle<LeftTuple_>, RightTupleLifecycle<RightTuple_>
Direct Known Subclasses:
ConcatBiBiNode, ConcatBiQuadNode, ConcatBiTriNode, ConcatBiUniNode, ConcatQuadBiNode, ConcatQuadQuadNode, ConcatQuadTriNode, ConcatQuadUniNode, ConcatTriBiNode, ConcatTriQuadNode, ConcatTriTriNode, ConcatTriUniNode, ConcatUniBiNode, ConcatUniQuadNode, ConcatUniTriNode, ConcatUniUniNode

public abstract class AbstractConcatNode<LeftTuple_ extends AbstractTuple,RightTuple_ extends AbstractTuple,OutTuple_ extends AbstractTuple> extends AbstractTwoInputNode<LeftTuple_,RightTuple_>
Implements the concat operation. Concat cannot be implemented as a pass-through operation because of two caveats:
  • It is possible to have the same TupleSource for both parent streams, in which case the exact same tuple can be inserted twice. Such a tuple should be counted twice downstream, and thus need to be cloned.
  • Because concat has two parent nodes, it must be a TupleSource (since all nodes have exactly one TupleSource, and the source tuple can come from either parent). TupleSource must produce new tuples and not reuse them, since if tuples are reused, the stores inside them get corrupted.
The AbstractConcatNode works by creating a copy of the source tuple and putting it into the tuple's store. If the same tuple is inserted twice (i.e. when the left and right parent have the same TupleSource), it creates another clone.
  • Field Details

    • outputStoreSize

      protected final int outputStoreSize
  • Constructor Details

    • AbstractConcatNode

      protected AbstractConcatNode(TupleLifecycle<OutTuple_> nextNodesTupleLifecycle, int leftSourceTupleCloneStoreIndex, int rightSourceTupleCloneStoreIndex, int outputStoreSize)
  • Method Details

    • getOutTupleFromLeft

      protected abstract OutTuple_ getOutTupleFromLeft(LeftTuple_ leftTuple)
    • getOutTupleFromRight

      protected abstract OutTuple_ getOutTupleFromRight(RightTuple_ rightTuple)
    • updateOutTupleFromLeft

      protected abstract void updateOutTupleFromLeft(LeftTuple_ leftTuple, OutTuple_ outTuple)
    • updateOutTupleFromRight

      protected abstract void updateOutTupleFromRight(RightTuple_ rightTuple, OutTuple_ outTuple)
    • insertLeft

      public final void insertLeft(LeftTuple_ tuple)
    • updateLeft

      public final void updateLeft(LeftTuple_ tuple)
    • retractLeft

      public final void retractLeft(LeftTuple_ tuple)
    • insertRight

      public final void insertRight(RightTuple_ tuple)
    • updateRight

      public final void updateRight(RightTuple_ tuple)
    • retractRight

      public final void retractRight(RightTuple_ tuple)
    • getPropagator

      public Propagator getPropagator()
      Description copied from class: AbstractNode
      Instead of calling the propagation directly from here, we export the propagation queue and allow BavetConstraintSession to call it. This is done with the idea that Propagator only has two implementations (unlike AbstractNode with myriad implementations) and therefore JVM call site optimizations will kick in to make the method dispatch faster.
      Specified by:
      getPropagator in class AbstractNode
      Returns:
      never null; the PropagationQueue in use by this node