Class AbstractForEachUniNode<A>

java.lang.Object
ai.timefold.solver.core.impl.bavet.common.AbstractNode
ai.timefold.solver.core.impl.bavet.uni.AbstractForEachUniNode<A>
Type Parameters:
A -
Direct Known Subclasses:
ForEachExcludingPinnedUniNode, ForEachExcludingUnassignedUniNode, ForEachIncludingUnassignedUniNode

@NullMarked public abstract sealed class AbstractForEachUniNode<A> extends AbstractNode permits ForEachExcludingUnassignedUniNode<A>, ForEachExcludingPinnedUniNode<Solution_,A>, ForEachIncludingUnassignedUniNode<A>
Filtering nodes are expensive. Considering that most streams start with a nullity check on genuine planning variables, it makes sense to create a specialized version of the node for this case (ForEachExcludingUnassignedUniNode), as opposed to forcing an extra filter node on the generic case (ForEachIncludingUnassignedUniNode).
  • Field Details

  • Constructor Details

    • AbstractForEachUniNode

      protected AbstractForEachUniNode(Class<A> forEachClass, TupleLifecycle<UniTuple<A>> nextNodesTupleLifecycle, int outputStoreSize)
  • Method Details

    • insert

      public void insert(A a)
    • update

      public abstract void update(A a)
    • updateExisting

      protected final void updateExisting(A a, UniTuple<A> tuple)
    • retract

      public void retract(A a)
    • retractExisting

      protected void retractExisting(A a, UniTuple<A> 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
    • getForEachClass

      public final Class<A> getForEachClass()
    • supports

      public abstract boolean supports(AbstractForEachUniNode.LifecycleOperation lifecycleOperation)
      Determines if this node supports the given lifecycle operation. Unsupported nodes will not be called during that lifecycle operation.
      Parameters:
      lifecycleOperation - the lifecycle operation to check
      Returns:
      true if the given lifecycle operation is supported; otherwise, false.
    • toString

      public final String toString()
      Overrides:
      toString in class AbstractNode