class BavetConstraintStreamScoreDirector<Solution_, Score_ extends Score<Score_>>
        extends AbstractScoreDirector<Solution_, Score_, BavetConstraintStreamScoreDirectorFactory<Solution_, Score_>> {

    protected BavetConstraintSession<Score_> session;

    public BavetConstraintStreamScoreDirector(
            BavetConstraintStreamScoreDirectorFactory<Solution_, Score_> scoreDirectorFactory,
            boolean lookUpEnabled, boolean constraintMatchEnabledPreference) {
        super(scoreDirectorFactory, lookUpEnabled, constraintMatchEnabledPreference);
    }

    // ************************************************************************
    // Complex methods
    // ************************************************************************

    @Override
    public void setWorkingSolution(Solution_ workingSolution) {
        super.setWorkingSolution(workingSolution);
        resetConstraintStreamingSession();
    }

    private void resetConstraintStreamingSession() {
        session = scoreDirectorFactory.newSession(constraintMatchEnabledPreference, workingSolution);
        getSolutionDescriptor().visitAll(workingSolution, session::insert);
    }

    @Override
    public Score_ calculateScore() {
        variableListenerSupport.assertNotificationQueuesAreEmpty();
        Score_ score = session.calculateScore(workingInitScore);
        setCalculatedScore(score);
        return score;
    }

    @Override
    public boolean isConstraintMatchEnabled() {
        return constraintMatchEnabledPreference;
    }

    @Override
    public Map<String, ConstraintMatchTotal<Score_>> getConstraintMatchTotalMap() {
        if (workingSolution == null) {
            throw new IllegalStateException(
                    "The method setWorkingSolution() must be called before the method getConstraintMatchTotalMap().");
        }
        return session.getConstraintMatchTotalMap();
    }

    @Override
    public Map<Object, Indictment<Score_>> getIndictmentMap() {<FILL_FUNCTION_BODY>}

    @Override
    public boolean requiresFlushing() {
        return true; // Tuple refresh happens during score calculation.
    }

    @Override
    public void close() {
        super.close();
        session = null;
    }

    // ************************************************************************
    // Entity/variable add/change/remove methods
    // ************************************************************************

    // public void beforeEntityAdded(EntityDescriptor entityDescriptor, Object entity) // Do nothing

    @Override
    public void afterEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity) {
        if (entity == null) {
            throw new IllegalArgumentException("The entity (" + entity + ") cannot be added to the ScoreDirector.");
        }
        if (!getSolutionDescriptor().hasEntityDescriptor(entity.getClass())) {
            throw new IllegalArgumentException("The entity (" + entity + ") of class (" + entity.getClass()
                    + ") is not a configured @" + PlanningEntity.class.getSimpleName() + ".");
        }
        session.insert(entity);
        super.afterEntityAdded(entityDescriptor, entity);
    }

    // public void beforeVariableChanged(VariableDescriptor variableDescriptor, Object entity) // Do nothing

    @Override
    public void afterVariableChanged(VariableDescriptor<Solution_> variableDescriptor, Object entity) {
        session.update(entity);
        super.afterVariableChanged(variableDescriptor, entity);
    }

    @Override
    public void afterListVariableChanged(ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int fromIndex,
            int toIndex) {
        session.update(entity);
        super.afterListVariableChanged(variableDescriptor, entity, fromIndex, toIndex);
    }

    // public void beforeEntityRemoved(EntityDescriptor entityDescriptor, Object entity) // Do nothing

    @Override
    public void afterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity) {
        session.retract(entity);
        super.afterEntityRemoved(entityDescriptor, entity);
    }

    // ************************************************************************
    // Problem fact add/change/remove methods
    // ************************************************************************

    // public void beforeProblemFactAdded(Object problemFact) // Do nothing

    @Override
    public void afterProblemFactAdded(Object problemFact) {
        if (problemFact == null) {
            throw new IllegalArgumentException("The problemFact (" + problemFact + ") cannot be added to the ScoreDirector.");
        }
        session.insert(problemFact);
        super.afterProblemFactAdded(problemFact);
    }

    // public void beforeProblemPropertyChanged(Object problemFactOrEntity) // Do nothing

    @Override
    public void afterProblemPropertyChanged(Object problemFactOrEntity) {
        session.update(problemFactOrEntity);
        super.afterProblemPropertyChanged(problemFactOrEntity);
    }

    // public void beforeProblemFactRemoved(Object problemFact) // Do nothing

    @Override
    public void afterProblemFactRemoved(Object problemFact) {
        session.retract(problemFact);
        super.afterProblemFactRemoved(problemFact);
    }

    // ************************************************************************
    // Getters/setters
    // ************************************************************************

    public BavetConstraintSession<Score_> getSession() {
        return session;
    }
}

        if (workingSolution == null) {
            throw new IllegalStateException(
                    "The method setWorkingSolution() must be called before the method getIndictmentMap().");
        }
        return session.getIndictmentMap();
    
<methods>public final void afterEntityAdded(java.lang.Object) ,public void afterEntityAdded(EntityDescriptor<Solution_>, java.lang.Object) ,public final void afterEntityRemoved(java.lang.Object) ,public void afterEntityRemoved(EntityDescriptor<Solution_>, java.lang.Object) ,public void afterListVariableChanged(java.lang.Object, java.lang.String, int, int) ,public void afterListVariableChanged(ListVariableDescriptor<Solution_>, java.lang.Object, int, int) ,public void afterListVariableElementAssigned(java.lang.Object, java.lang.String, java.lang.Object) ,public void afterListVariableElementAssigned(ListVariableDescriptor<Solution_>, java.lang.Object) ,public void afterListVariableElementUnassigned(java.lang.Object, java.lang.String, java.lang.Object) ,public void afterListVariableElementUnassigned(ListVariableDescriptor<Solution_>, java.lang.Object) ,public void afterProblemFactAdded(java.lang.Object) ,public void afterProblemFactRemoved(java.lang.Object) ,public void afterProblemPropertyChanged(java.lang.Object) ,public final void afterVariableChanged(java.lang.Object, java.lang.String) ,public void afterVariableChanged(VariableDescriptor<Solution_>, java.lang.Object) ,public void assertExpectedUndoMoveScore(Move<Solution_>, Score_) ,public void assertExpectedWorkingScore(Score_, java.lang.Object) ,public void assertNonNullPlanningIds() ,public void assertPredictedScoreFromScratch(Score_, java.lang.Object) ,public void assertShadowVariablesAreNotStale(Score_, java.lang.Object) ,public void assertWorkingScoreFromScratch(Score_, java.lang.Object) ,public final void beforeEntityAdded(java.lang.Object) ,public void beforeEntityAdded(EntityDescriptor<Solution_>, java.lang.Object) ,public final void beforeEntityRemoved(java.lang.Object) ,public void beforeEntityRemoved(EntityDescriptor<Solution_>, java.lang.Object) ,public void beforeListVariableChanged(java.lang.Object, java.lang.String, int, int) ,public void beforeListVariableChanged(ListVariableDescriptor<Solution_>, java.lang.Object, int, int) ,public void beforeListVariableElementAssigned(java.lang.Object, java.lang.String, java.lang.Object) ,public void beforeListVariableElementAssigned(ListVariableDescriptor<Solution_>, java.lang.Object) ,public void beforeListVariableElementUnassigned(java.lang.Object, java.lang.String, java.lang.Object) ,public void beforeListVariableElementUnassigned(ListVariableDescriptor<Solution_>, java.lang.Object) ,public void beforeProblemFactAdded(java.lang.Object) ,public void beforeProblemFactRemoved(java.lang.Object) ,public void beforeProblemPropertyChanged(java.lang.Object) ,public final void beforeVariableChanged(java.lang.Object, java.lang.String) ,public void beforeVariableChanged(VariableDescriptor<Solution_>, java.lang.Object) ,public void changeVariableFacade(VariableDescriptor<Solution_>, java.lang.Object, java.lang.Object) ,public AbstractScoreDirector<Solution_,Score_,BavetConstraintStreamScoreDirectorFactory<Solution_,Score_>> clone() ,public Solution_ cloneSolution(Solution_) ,public Solution_ cloneWorkingSolution() ,public void close() ,public InnerScoreDirector<Solution_,Score_> createChildThreadScoreDirector(org.optaplanner.core.impl.solver.thread.ChildThreadType) ,public Score_ doAndProcessMove(Move<Solution_>, boolean) ,public void doAndProcessMove(Move<Solution_>, boolean, Consumer<Score_>) ,public void forceTriggerVariableListeners() ,public long getCalculationCount() ,public ScoreDefinition<Score_> getScoreDefinition() ,public BavetConstraintStreamScoreDirectorFactory<Solution_,Score_> getScoreDirectorFactory() ,public SolutionDescriptor<Solution_> getSolutionDescriptor() ,public org.optaplanner.core.impl.domain.variable.supply.SupplyManager getSupplyManager() ,public long getWorkingEntityListRevision() ,public Solution_ getWorkingSolution() ,public void incrementCalculationCount() ,public boolean isWorkingEntityListDirty(long) ,public E lookUpWorkingObject(E) ,public E lookUpWorkingObjectOrReturnNull(E) ,public void overwriteConstraintMatchEnabledPreference(boolean) ,public void resetCalculationCount() ,public void setAllChangesWillBeUndoneBeforeStepEnds(boolean) ,public void setWorkingSolution(Solution_) ,public java.lang.String toString() ,public void triggerVariableListeners() <variables>protected boolean allChangesWillBeUndoneBeforeStepEnds,protected long calculationCount,protected boolean constraintMatchEnabledPreference,protected final transient Logger logger,protected final non-sealed boolean lookUpEnabled,protected final non-sealed org.optaplanner.core.impl.domain.lookup.LookUpManager lookUpManager,private final Map<Class#RAW,org.optaplanner.core.impl.domain.common.accessor.MemberAccessor> planningIdAccessorCacheMap,protected final non-sealed BavetConstraintStreamScoreDirectorFactory<Solution_,Score_> scoreDirectorFactory,protected final non-sealed VariableListenerSupport<Solution_> variableListenerSupport,protected long workingEntityListRevision,protected java.lang.Integer workingInitScore,protected Solution_ workingSolution