Record Class BavetStaticDataFactory<Solution_>

java.lang.Object
java.lang.Record
ai.timefold.solver.core.impl.score.stream.bavet.BavetStaticDataFactory<Solution_>
All Implemented Interfaces:
PrecomputeFactory

public record BavetStaticDataFactory<Solution_>(BavetConstraintFactory<Solution_> constraintFactory) extends Record implements PrecomputeFactory
  • Constructor Details

    • BavetStaticDataFactory

      public BavetStaticDataFactory(BavetConstraintFactory<Solution_> constraintFactory)
      Creates an instance of a BavetStaticDataFactory record class.
      Parameters:
      constraintFactory - the value for the constraintFactory record component
  • Method Details

    • forEachUnfiltered

      public <A> UniConstraintStream<A> forEachUnfiltered(Class<A> sourceClass)
      Description copied from interface: PrecomputeFactory
      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.

      Specified by:
      forEachUnfiltered in interface PrecomputeFactory
      Type Parameters:
      A - the type of the matched problem fact or planning entity
    • forEachUnfilteredUniquePair

      public <A> BiConstraintStream<A,A> forEachUnfilteredUniquePair(Class<A> sourceClass, BiJoiner<A,A>... joiners)
      Description copied from interface: PrecomputeFactory
      As defined by PrecomputeFactory.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.

      Specified by:
      forEachUnfilteredUniquePair in interface PrecomputeFactory
      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
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • constraintFactory

      public BavetConstraintFactory<Solution_> constraintFactory()
      Returns the value of the constraintFactory record component.
      Returns:
      the value of the constraintFactory record component