use of org.drools.core.beliefsystem.simple.SimpleLogicalDependency in project drools by kiegroup.
the class DefaultKnowledgeHelper method blockMatch.
public void blockMatch(Match act) {
AgendaItem targetMatch = (AgendaItem) act;
// iterate to find previous equal logical insertion
LogicalDependency<SimpleMode> dep = null;
if (this.previousBlocked != null) {
for (dep = this.previousBlocked.getFirst(); dep != null; dep = dep.getNext()) {
if (targetMatch == dep.getJustified()) {
this.previousBlocked.remove(dep);
break;
}
}
}
if (dep == null) {
SimpleMode mode = new SimpleMode();
dep = new SimpleLogicalDependency(activation, targetMatch, mode);
mode.setObject(dep);
}
this.activation.addBlocked(dep);
if (targetMatch.getBlockers().size() == 1 && targetMatch.isQueued()) {
if (targetMatch.getRuleAgendaItem() == null) {
// it wasn't blocked before, but is now, so we must remove it from all groups, so it cannot be executed.
targetMatch.remove();
} else {
targetMatch.getRuleAgendaItem().getRuleExecutor().removeLeftTuple(targetMatch.getTuple());
}
if (targetMatch.getActivationGroupNode() != null) {
targetMatch.getActivationGroupNode().getActivationGroup().removeActivation(targetMatch);
}
if (targetMatch.getActivationNode() != null) {
final InternalRuleFlowGroup ruleFlowGroup = (InternalRuleFlowGroup) targetMatch.getActivationNode().getParentContainer();
ruleFlowGroup.remove(targetMatch);
}
}
}
use of org.drools.core.beliefsystem.simple.SimpleLogicalDependency in project drools by kiegroup.
the class JTMSBeliefSystem method newLogicalDependency.
public LogicalDependency newLogicalDependency(Activation<M> activation, BeliefSet<M> beliefSet, Object object, Object value) {
JTMSMode<M> mode = asMode(value);
SimpleLogicalDependency dep = new SimpleLogicalDependency(activation, beliefSet, object, mode);
mode.setLogicalDependency(dep);
return dep;
}
use of org.drools.core.beliefsystem.simple.SimpleLogicalDependency in project drools by kiegroup.
the class BayesBeliefSystem method newLogicalDependency.
@Override
public LogicalDependency<M> newLogicalDependency(Activation<M> activation, BeliefSet<M> beliefSet, Object object, Object value) {
BayesHardEvidence<M> mode = (M) value;
SimpleLogicalDependency dep = new SimpleLogicalDependency(activation, beliefSet, object, (M) value);
mode.setLogicalDependency(dep);
return dep;
}
Aggregations