public class CompoundStopCondition extends Object implements ApplyStrategy.IStopCondition
ApplyStrategy.IStopCondition
contains other ApplyStrategy.IStopCondition
as
children and stops the auto mode if at least on of its children force it.Modifier and Type | Field and Description |
---|---|
private List<ApplyStrategy.IStopCondition> |
children
The child
ApplyStrategy.IStopCondition s to use. |
private ApplyStrategy.IStopCondition |
lastGoalAllowedChild
The last
ApplyStrategy.IStopCondition treated in #isGoalAllowed(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, Goal)
which will provide the reason via #getGoalNotAllowedMessage(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, Goal) . |
private ApplyStrategy.IStopCondition |
lastShouldStopChild
The last
ApplyStrategy.IStopCondition treated in #shouldStop(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, SingleRuleApplicationInfo)
which will provide the reason via #getStopMessage(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, SingleRuleApplicationInfo) . |
Constructor and Description |
---|
CompoundStopCondition(ApplyStrategy.IStopCondition... children)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addChildren(ApplyStrategy.IStopCondition... children)
Adds new child
ApplyStrategy.IStopCondition s. |
List<ApplyStrategy.IStopCondition> |
getChildren() |
String |
getGoalNotAllowedMessage(int maxApplications,
long timeout,
Proof proof,
IGoalChooser goalChooser,
long startTime,
int countApplied,
Goal goal)
Returns the reason why the previous check via
#isGoalAllowed(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, Goal)
has stopped the apply strategy. |
int |
getMaximalWork(int maxApplications,
long timeout,
Proof proof,
IGoalChooser goalChooser)
Returns the maximal amount of work needed to complete the task,
used to display a progress bar.
|
String |
getStopMessage(int maxApplications,
long timeout,
Proof proof,
IGoalChooser goalChooser,
long startTime,
int countApplied,
ApplyStrategy.SingleRuleApplicationInfo singleRuleApplicationInfo)
Returns a human readable message which explains why the previous
#shouldStop(ApplyStrategy, Proof, IGoalChooser, long, int, SingleRuleApplicationInfo)
has stopped the strategy. |
boolean |
isGoalAllowed(int maxApplications,
long timeout,
Proof proof,
IGoalChooser goalChooser,
long startTime,
int countApplied,
Goal goal)
Checks if it is allowed to apply the next rule on the selected
Goal
chosen by the IGoalChooser before it is applied. |
void |
removeChild(ApplyStrategy.IStopCondition child) |
boolean |
shouldStop(int maxApplications,
long timeout,
Proof proof,
IGoalChooser goalChooser,
long startTime,
int countApplied,
ApplyStrategy.SingleRuleApplicationInfo singleRuleApplicationInfo)
Checks after each applied rule if more rules should be applied or if the strategy should stop.
|
private List<ApplyStrategy.IStopCondition> children
ApplyStrategy.IStopCondition
s to use.private ApplyStrategy.IStopCondition lastGoalAllowedChild
ApplyStrategy.IStopCondition
treated in #isGoalAllowed(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, Goal)
which will provide the reason via #getGoalNotAllowedMessage(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, Goal)
.private ApplyStrategy.IStopCondition lastShouldStopChild
ApplyStrategy.IStopCondition
treated in #shouldStop(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, SingleRuleApplicationInfo)
which will provide the reason via #getStopMessage(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, SingleRuleApplicationInfo)
.public CompoundStopCondition(ApplyStrategy.IStopCondition... children)
children
- The child ApplyStrategy.IStopCondition
s to use.public void addChildren(ApplyStrategy.IStopCondition... children)
ApplyStrategy.IStopCondition
s.children
- The child ApplyStrategy.IStopCondition
s to use.public void removeChild(ApplyStrategy.IStopCondition child)
public int getMaximalWork(int maxApplications, long timeout, Proof proof, IGoalChooser goalChooser)
0
to indicate unknown size.getMaximalWork
in interface ApplyStrategy.IStopCondition
maxApplications
- The defined maximal number of rules to apply. Can be different to StrategySettings.getMaxSteps()
in side proofs.timeout
- The defined timeout in ms or -1
if disabled. Can be different to StrategySettings.getTimeout()
in side proofs.proof
- The current Proof
.goalChooser
- The current IGoalChooser
.0
if it is unknown.public boolean isGoalAllowed(int maxApplications, long timeout, Proof proof, IGoalChooser goalChooser, long startTime, int countApplied, Goal goal)
Goal
chosen by the IGoalChooser
before it is applied.
If it is not allowed the apply strategy will stop.isGoalAllowed
in interface ApplyStrategy.IStopCondition
maxApplications
- The defined maximal number of rules to apply. Can be different to StrategySettings.getMaxSteps()
in side proofs.timeout
- The defined timeout in ms or -1
if disabled. Can be different to StrategySettings.getTimeout()
in side proofs.proof
- The current Proof
.goalChooser
- The current IGoalChooser
.startTime
- The timestamp when the apply strategy has started, computed via System.currentTimeMillis()
countApplied
- The number of already applied rules.goal
- The current Goal
on which the next rule will be applied.true
rule application is allowed, false
rule application is not allowed so stop apply strategypublic String getGoalNotAllowedMessage(int maxApplications, long timeout, Proof proof, IGoalChooser goalChooser, long startTime, int countApplied, Goal goal)
#isGoalAllowed(ApplyStrategy, int, long, Proof, IGoalChooser, long, int, Goal)
has stopped the apply strategy.getGoalNotAllowedMessage
in interface ApplyStrategy.IStopCondition
maxApplications
- The defined maximal number of rules to apply. Can be different to StrategySettings.getMaxSteps()
in side proofs.timeout
- The defined timeout in ms or -1
if disabled. Can be different to StrategySettings.getTimeout()
in side proofs.proof
- The current Proof
.goalChooser
- The current IGoalChooser
.startTime
- The timestamp when the apply strategy has started, computed via System.currentTimeMillis()
countApplied
- The number of already applied rules.goal
- The current Goal
on which the next rule will be applied.public boolean shouldStop(int maxApplications, long timeout, Proof proof, IGoalChooser goalChooser, long startTime, int countApplied, ApplyStrategy.SingleRuleApplicationInfo singleRuleApplicationInfo)
shouldStop
in interface ApplyStrategy.IStopCondition
maxApplications
- The defined maximal number of rules to apply. Can be different to StrategySettings.getMaxSteps()
in side proofs.timeout
- The defined timeout in ms or -1
if disabled. Can be different to StrategySettings.getTimeout()
in side proofs.proof
- The current Proof
.goalChooser
- The current IGoalChooser
.startTime
- The timestamp when the apply strategy has started, computed via System.currentTimeMillis()
countApplied
- The number of already applied rules.singleRuleApplicationInfo
- An optional ApplyStrategy.SingleRuleApplicationInfo
.true
stop strategy, false
continue strategy and apply next rule.public String getStopMessage(int maxApplications, long timeout, Proof proof, IGoalChooser goalChooser, long startTime, int countApplied, ApplyStrategy.SingleRuleApplicationInfo singleRuleApplicationInfo)
#shouldStop(ApplyStrategy, Proof, IGoalChooser, long, int, SingleRuleApplicationInfo)
has stopped the strategy.getStopMessage
in interface ApplyStrategy.IStopCondition
maxApplications
- The defined maximal number of rules to apply. Can be different to StrategySettings.getMaxSteps()
in side proofs.timeout
- The defined timeout in ms or -1
if disabled. Can be different to StrategySettings.getTimeout()
in side proofs.proof
- The current Proof
.goalChooser
- The current IGoalChooser
.startTime
- The timestamp when the apply strategy has started, computed via System.currentTimeMillis()
countApplied
- The number of already applied rules.singleRuleApplicationInfo
- An optional ApplyStrategy.SingleRuleApplicationInfo
.public List<ApplyStrategy.IStopCondition> getChildren()