Interface PrecomputeFactory

All Known Implementing Classes:
BavetStaticDataFactory

public interface PrecomputeFactory
Similar to a ConstraintFactory, except its methods (and the ConstraintStreams they return) do not apply any automatic filters (like those mentioned in ConstraintFactory.forEach(Class)).
  • Method Details

    • forEachUnfiltered

      <A> UniConstraintStream<A> forEachUnfiltered(Class<A> sourceClass)
      As defined by ConstraintFactory.forEachUnfiltered(Class), with the additional change of any joining stream will also be unfiltered.

      For example,

       precomputeFactory.forEachUnfiltered(Shift.class)
               .join(Shift.class, Joiners.equal(Shift::getLocation));
       

      Would roughly be equivalent to

       constraintFactory.forEachUnfiltered(Shift.class)
               .join(constraintFactory.forEachUnfiltered(Shift.class),
                       Joiners.equal(Shift::getLocation));
       

      Important: no variables can be referenced in any operations performed by the returned ConstraintStream, otherwise a score corruption will occur. See the note in ConstraintFactory.precompute(Function) for more details.

      Type Parameters:
      A - the type of the matched problem fact or planning entity
    • forEachUnfilteredUniquePair

      default <A> BiConstraintStream<A,A> forEachUnfilteredUniquePair(Class<A> sourceClass)
      As defined by ConstraintFactory.forEachUniquePair(Class), with the additional change that the problem facts/entities are unfiltered.

      For example,

       precomputeFactory.forEachUnfilteredUniquePair(Shift.class);
       

      Would roughly be equivalent to

       constraintFactory.forEachUnfiltered(Shift.class)
               .join(constraintFactory.forEachUnfiltered(Shift.class),
                       Joiners.lessThan(Shift::getId));
       

      Important: no variables can be referenced in any operations performed by the returned ConstraintStream, otherwise a score corruption will occur. See the note in ConstraintFactory.precompute(Function) for more details.

      Type Parameters:
      A - the type of the matched problem fact or planning entity
    • forEachUnfilteredUniquePair

      default <A> BiConstraintStream<A,A> forEachUnfilteredUniquePair(Class<A> sourceClass, BiJoiner<A,A> joiner)
      As defined by ConstraintFactory.forEachUniquePair(Class, BiJoiner), with the additional change that the problem facts/entities are unfiltered.

      For example,

       precomputeFactory.forEachUnfilteredUniquePair(Shift.class, Joiners.equal(Shift::getLocation));
       

      Would roughly be equivalent to

       constraintFactory.forEachUnfiltered(Shift.class)
               .join(constraintFactory.forEachUnfiltered(Shift.class),
                       Joiners.lessThan(Shift::getId),
                       Joiners.equal(Shift::getLocation));
       

      Important: no variables can be referenced in any operations performed by the returned ConstraintStream, otherwise a score corruption will occur. See the note in ConstraintFactory.precompute(Function) for more details.

      Type Parameters:
      A - the type of the matched problem fact or planning entity
    • forEachUnfilteredUniquePair

      default <A> BiConstraintStream<A,A> forEachUnfilteredUniquePair(Class<A> sourceClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
      Type Parameters:
      A - the type of the matched problem fact or planning entity
      Returns:
      a stream that matches every unique combination of A and another A for which all the joiners are true
    • forEachUnfilteredUniquePair

      default <A> BiConstraintStream<A,A> forEachUnfilteredUniquePair(Class<A> sourceClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
      Type Parameters:
      A - the type of the matched problem fact or planning entity
      Returns:
      a stream that matches every unique combination of A and another A for which all the joiners are true
    • forEachUnfilteredUniquePair

      default <A> BiConstraintStream<A,A> forEachUnfilteredUniquePair(Class<A> sourceClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
      Type Parameters:
      A - the type of the matched problem fact or planning entity
      Returns:
      a stream that matches every unique combination of A and another A for which all the joiners are true
    • forEachUnfilteredUniquePair

      <A> BiConstraintStream<A,A> forEachUnfilteredUniquePair(Class<A> sourceClass, BiJoiner<A,A>... joiners)
      As defined by forEachUnfilteredUniquePair(Class, BiJoiner).

      This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a SafeVarargs annotation because it's an interface method. Therefore, there are overloaded methods with up to 4 BiJoiner parameters.

      Type Parameters:
      A - the type of the matched problem fact or planning entity
      Returns:
      a stream that matches every unique combination of A and another A for which all the joiners are true