org.drools.common
Class TruthMaintenanceSystem
java.lang.Object
org.drools.common.TruthMaintenanceSystem
public class TruthMaintenanceSystem
- extends Object
The Truth Maintenance System is responsible for tracking two things. Firstly
It maintains a Map to track the classes with the same Equality, using the
EqualityKey. The EqualityKey has an internal datastructure which references
all the handles which are equal. Secondly It maintains another map tracking
the justificiations for logically asserted facts.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TruthMaintenanceSystem
public TruthMaintenanceSystem()
TruthMaintenanceSystem
public TruthMaintenanceSystem(AbstractWorkingMemory workingMemory)
getJustifiedMap
public ObjectHashMap getJustifiedMap()
getAssertMap
public ObjectHashMap getAssertMap()
put
public Object put(EqualityKey key)
get
public EqualityKey get(EqualityKey key)
get
public EqualityKey get(Object object)
remove
public EqualityKey remove(EqualityKey key)
removeLogicalDependencies
public void removeLogicalDependencies(Activation activation,
PropagationContext context,
Rule rule)
throws FactException
- An Activation is no longer true so it no longer justifies any of the logical facts
it logically asserted. It iterates over the Activation's LinkedList of DependencyNodes
it retrieves the justitication set for each DependencyNode's FactHandle and removes
itself. If the Set is empty it retracts the FactHandle from the WorkingMemory.
- Parameters:
activation
- context
- rule
-
- Throws:
FactException
removeLogicalDependency
public void removeLogicalDependency(Activation activation,
LogicalDependency node,
PropagationContext context)
removeLogicalDependencies
public void removeLogicalDependencies(InternalFactHandle handle)
throws FactException
- The FactHandle is being removed from the system so remove any logical dependencies
between the justified FactHandle and its justifiers. Removes the FactHandle key
from the justifiedMap. It then iterates over all the LogicalDependency nodes, if any,
in the returned Set and removes the LogicalDependency node from the LinkedList maintained
by the Activation.
- Parameters:
handle
- - The FactHandle to be removed
- Throws:
FactException
- See Also:
LogicalDependency
addLogicalDependency
public void addLogicalDependency(InternalFactHandle handle,
Activation activation,
PropagationContext context,
Rule rule)
throws FactException
- Adds a justification for the FactHandle to the justifiedMap.
- Parameters:
handle
- activation
- context
- rule
-
- Throws:
FactException
clear
public void clear()
Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.