Class Fold.Retryable
- java.lang.Object
-
- org.projog.core.predicate.builtin.list.Fold.Retryable
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Variable>accumulatorsprivate Termactionprivate java.util.List<Term>backtrack1private java.util.List<Term>backtrack2private intidxprivate PredicateFactorypfprivate java.util.List<Predicate>predicatesprivate Termresultprivate Termstartprivate java.util.List<Term>values
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancouldReevaluationSucceed()Could the next re-evaluation of this instance succeed?booleanevaluate()Attempts to satisfy the goal this instance represents.
-
-
-
Field Detail
-
pf
private final PredicateFactory pf
-
action
private final Term action
-
values
private final java.util.List<Term> values
-
start
private final Term start
-
result
private final Term result
-
predicates
private final java.util.List<Predicate> predicates
-
accumulators
private final java.util.List<Variable> accumulators
-
backtrack1
private final java.util.List<Term> backtrack1
-
backtrack2
private final java.util.List<Term> backtrack2
-
idx
private int idx
-
-
Constructor Detail
-
Retryable
private Retryable(PredicateFactory pf, Term action, java.util.List<Term> values, Term start, Term result)
-
-
Method Detail
-
evaluate
public boolean evaluate()
Description copied from interface:PredicateAttempts to satisfy the goal this instance represents.Calling this method multiple times on a single instance allows all possible answers to be identified. An attempt to find a solution carries on from where the last successful call finished.
If
PredicateFactory.isRetryable()returnsfalsethen this method should only be called once per individual query (no attempt should be made to find alternative solutions).If
PredicateFactory.isRetryable()returnstruethen, in order to find all possible solutions for an individual query, this method should be recalled on backtracking until it returnsfalse.- Specified by:
evaluatein interfacePredicate- Returns:
trueif it was possible to satisfy the clause,falseotherwise- See Also:
PredicateFactory.getPredicate(Term[])
-
couldReevaluationSucceed
public boolean couldReevaluationSucceed()
Description copied from interface:PredicateCould the next re-evaluation of this instance succeed?Specifies whether a specific instance of a specific implementation of
Predicate, that has already hadPredicate.evaluate()called on it at least once, could possibly returntruethe next timePredicate.evaluate()is called on it. i.e. is it worth trying to continue to find solutions for the specific query this particular instance represents and has been evaluating?(Note: the difference between this method and
PredicateFactory.isRetryable()is thatPredicateFactory.isRetryable()deals with whether, in general, a specific implementation (rather than instance) ofPredicatecould ever produce multiple answers for an individual query.)- Specified by:
couldReevaluationSucceedin interfacePredicate- Returns:
trueif an attempt to re-evaluate this instance could possible succeed,falseotherwise
-
-