Interface ProblemChangeDirector

    • Method Detail

      • addProblemFact

        <ProblemFact> void addProblemFact​(ProblemFact problemFact,
                                          Consumer<ProblemFact> problemFactConsumer)
        Add a new problem fact into the working solution.
        Type Parameters:
        ProblemFact - the problem fact object type
        Parameters:
        problemFact - never null; the problem fact instance
        problemFactConsumer - never null; removes the working problem fact from the working solution
      • removeProblemFact

        <ProblemFact> void removeProblemFact​(ProblemFact problemFact,
                                             Consumer<ProblemFact> problemFactConsumer)
        Remove an existing problem fact from the working solution. Translates the problem fact to a working problem fact by performing a lookup as defined by lookUpWorkingObjectOrFail(Object).
        Type Parameters:
        ProblemFact - the problem fact object type
        Parameters:
        problemFact - never null; the problem fact instance
        problemFactConsumer - never null; removes the working problem fact from the working solution
      • changeProblemProperty

        <EntityOrProblemFact> void changeProblemProperty​(EntityOrProblemFact problemFactOrEntity,
                                                         Consumer<EntityOrProblemFact> problemFactOrEntityConsumer)
        Change a property of either a PlanningEntity or a problem fact. Translates the entity or the problem fact to its working solution counterpart by performing a lookup as defined by lookUpWorkingObjectOrFail(Object).
        Type Parameters:
        EntityOrProblemFact - the planning entity or problem fact object type
        Parameters:
        problemFactOrEntity - never null; the PlanningEntity or the problem fact instance
        problemFactOrEntityConsumer - never null; updates the property of the PlanningEntity or the problem fact
      • lookUpWorkingObjectOrFail

        <EntityOrProblemFact> EntityOrProblemFact lookUpWorkingObjectOrFail​(EntityOrProblemFact externalObject)
        Translate an entity or fact instance (often from another Thread or JVM) to this ProblemChangeDirector's internal working instance.

        Matching is determined by the LookUpStrategyType on PlanningSolution. Matching uses a PlanningId by default.

        Type Parameters:
        EntityOrProblemFact - the object type
        Parameters:
        externalObject - sometimes null
        Returns:
        null if externalObject is null
        Throws:
        IllegalArgumentException - if there is no workingObject for externalObject, if it cannot be looked up or if the externalObject's class is not supported
        IllegalStateException - if it cannot be looked up
      • lookUpWorkingObject

        <EntityOrProblemFact> Optional<EntityOrProblemFact> lookUpWorkingObject​(EntityOrProblemFact externalObject)
        As defined by lookUpWorkingObjectOrFail(Object), but doesn't fail fast if no workingObject was ever added for the externalObject. It's recommended to use lookUpWorkingObjectOrFail(Object) instead.
        Type Parameters:
        EntityOrProblemFact - the object type
        Parameters:
        externalObject - sometimes null
        Returns:
        Optional.empty() if externalObject is null or if there is no workingObject for externalObject
        Throws:
        IllegalArgumentException - if it cannot be looked up or if the externalObject's class is not supported
        IllegalStateException - if it cannot be looked up