public class ForEachCP extends java.lang.Object implements Feature
ChoicePoint
that iterates over the
terms returned by a TermGenerator
. The terms are stored in a
TermBuffer
one after the other and can subsequently be used
to instantiate a rule applicationModifier and Type | Class and Description |
---|---|
private class |
ForEachCP.CP |
Modifier and Type | Field and Description |
---|---|
private Feature |
body |
private TermGenerator |
generator |
private BackTrackingManager |
manager |
private TermBuffer |
var |
Modifier | Constructor and Description |
---|---|
private |
ForEachCP(TermBuffer var,
TermGenerator generator,
Feature body,
BackTrackingManager manager) |
Modifier and Type | Method and Description |
---|---|
RuleAppCost |
computeCost(RuleApp app,
PosInOccurrence pos,
Goal goal)
Evaluate the cost of a
RuleApp . |
static Feature |
create(TermBuffer var,
TermGenerator generator,
Feature body,
BackTrackingManager manager) |
private final BackTrackingManager manager
private final TermBuffer var
private final TermGenerator generator
private final Feature body
private ForEachCP(TermBuffer var, TermGenerator generator, Feature body, BackTrackingManager manager)
public static Feature create(TermBuffer var, TermGenerator generator, Feature body, BackTrackingManager manager)
var
- TermBuffer
in which the terms are going to
be storedgenerator
- the terms that are to be iterated overbody
- a feature that is supposed to be evaluated repeatedly for the
possible values of var
public RuleAppCost computeCost(RuleApp app, PosInOccurrence pos, Goal goal)
Feature
RuleApp
.computeCost
in interface Feature
app
- the RuleApppos
- position where app
is to be appliedgoal
- the goal on which app
is to be appliedRuleAppCost
object. TopRuleAppCost.INSTANCE
indicates that the rule shall not be applied at all (it is discarded by
the strategy).