Interface ConstraintMatchSupplier<Score_ extends Score<Score_>>

  • All Superinterfaces:
    BiFunction<Constraint,​Score_,​ConstraintMatch<Score_>>
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ConstraintMatchSupplier<Score_ extends Score<Score_>>
    extends BiFunction<Constraint,​Score_,​ConstraintMatch<Score_>>
    Allows creating ConstraintMatch instances lazily if and only if they are required by the end user.

    Lazy behavior is important for constraint matching performance. In order to create ConstraintMatch, an entire ConstraintJustification object needs to be created, along with the collection of indicted objects. Creating these structures every time a constraint is matched would be wasteful, as the same constraint match can be undone almost immediately, resulting in a lot of pointless garbage. Therefore, ConstraintMatch (along with all of its supporting data structures) is only created when actually needed, and that is during score explanation. Until that point, this thin wrapper serves as a placeholder which understands what to create when needed.