use of org.drools.tms.SimpleMode in project drools by kiegroup.
the class SimpleBeliefSet method cancel.
public void cancel(PropagationContext context) {
// get all but last, as that we'll do via the BeliefSystem, for cleanup
SimpleMode entry = getFirst();
while (entry != getLast()) {
// get next, as we are about to remove it
SimpleMode temp = entry.getNext();
final LogicalDependency<SimpleMode> node = entry.getObject();
node.getJustifier().getLogicalDependencies().remove(node);
remove(entry);
entry = temp;
}
LinkedListEntry last = getFirst();
final LogicalDependency<SimpleMode> node = (LogicalDependency) last.getObject();
node.getJustifier().getLogicalDependencies().remove(node);
beliefSystem.delete(node, this, context);
}
use of org.drools.tms.SimpleMode in project drools by kiegroup.
the class SimpleBeliefSet method clear.
public void clear(PropagationContext context) {
// remove all, but don't allow the BeliefSystem to clean up, the FH is most likely going to be used else where
SimpleMode entry = getFirst();
while (entry != null) {
// get next, as we are about to remove it
SimpleMode temp = entry.getNext();
final LogicalDependency<SimpleMode> node = entry.getObject();
node.getJustifier().getLogicalDependencies().remove(node);
remove(entry);
entry = temp;
}
}
use of org.drools.tms.SimpleMode in project drools by kiegroup.
the class SimpleBeliefSystem method newLogicalDependency.
public LogicalDependency newLogicalDependency(TruthMaintenanceSystemActivation activation, BeliefSet beliefSet, Object object, Object value) {
SimpleMode mode = new SimpleMode();
SimpleLogicalDependency dep = new SimpleLogicalDependency(activation, beliefSet, object, mode);
mode.setObject(dep);
return dep;
}
use of org.drools.tms.SimpleMode in project drools by kiegroup.
the class TruthMaintenanceSystemRuleTerminalNodeLeftTuple method removeAllBlockersAndBlocked.
@Override
public void removeAllBlockersAndBlocked(ActivationsManager activationsManager) {
if (this.blockers != null) {
// Iterate and remove this node's logical dependency list from each of it's blockers
for (SimpleMode node = blockers.getFirst(); node != null; node = node.getNext()) {
LogicalDependency dep = node.getObject();
dep.getJustifier().getBlocked().remove(dep);
}
}
this.blockers = null;
if (this.blocked != null) {
// Iterate and remove this node's logical dependency list from each of it's blocked
for (LogicalDependency<SimpleMode> dep = blocked.getFirst(); dep != null; ) {
LogicalDependency<SimpleMode> tmp = dep.getNext();
removeBlocked(dep);
TruthMaintenanceSystemRuleTerminalNodeLeftTuple justified = (TruthMaintenanceSystemRuleTerminalNodeLeftTuple) dep.getJustified();
if (justified.getBlockers().isEmpty() && justified.isActive()) {
activationsManager.stageLeftTuple(ruleAgendaItem, justified);
}
dep = tmp;
}
}
this.blocked = null;
}
use of org.drools.tms.SimpleMode in project drools by kiegroup.
the class TruthMaintenanceSystemAgendaItemImpl method removeAllBlockersAndBlocked.
@Override
public void removeAllBlockersAndBlocked(ActivationsManager activationsManager) {
if (this.blockers != null) {
// Iterate and remove this node's logical dependency list from each of it's blockers
for (LinkedListEntry<SimpleMode, LogicalDependency<SimpleMode>> node = blockers.getFirst(); node != null; node = node.getNext()) {
LogicalDependency dep = node.getObject();
dep.getJustifier().getBlocked().remove(dep);
}
}
this.blockers = null;
if (this.blocked != null) {
// Iterate and remove this node's logical dependency list from each of it's blocked
for (LogicalDependency<SimpleMode> dep = blocked.getFirst(); dep != null; ) {
LogicalDependency<SimpleMode> tmp = dep.getNext();
removeBlocked(dep);
TruthMaintenanceSystemAgendaItemImpl justified = (TruthMaintenanceSystemAgendaItemImpl) dep.getJustified();
if (justified.getBlockers().isEmpty()) {
activationsManager.stageLeftTuple(null, justified);
}
dep = tmp;
}
}
this.blocked = null;
}
Aggregations