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.
|
Method Summary |
void |
addLogicalDependency(InternalFactHandle handle,
Object value,
Activation activation,
PropagationContext context,
Rule rule,
ObjectTypeConf typeConf)
|
void |
addLogicalDependency(InternalFactHandle handle,
Object value,
Activation activation,
PropagationContext context,
Rule rule,
ObjectTypeConf typeConf,
boolean read)
|
void |
clear()
|
EqualityKey |
get(EqualityKey key)
|
EqualityKey |
get(Object object)
|
ObjectHashMap |
getAssertMap()
|
ObjectHashMap |
getJustifiedMap()
|
BeliefSet |
newTMSbeliefSet()
|
Object |
put(EqualityKey key)
|
void |
readLogicalDependency(InternalFactHandle handle,
Object value,
Activation activation,
PropagationContext context,
Rule rule,
ObjectTypeConf typeConf)
Adds a justification for the FactHandle to the justifiedMap. |
EqualityKey |
remove(EqualityKey key)
|
void |
removeLogicalDependencies(Activation activation,
PropagationContext context,
Rule rule)
An Activation is no longer true so it no longer justifies any of the logical facts
it logically asserted. |
void |
removeLogicalDependencies(InternalFactHandle handle)
The FactHandle is being removed from the system so remove any logical dependencies
between the justified FactHandle and its justifiers. |
void |
removeLogicalDependency(Activation activation,
LogicalDependency node,
PropagationContext context)
|
| 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 wm)
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(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
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)
readLogicalDependency
public void readLogicalDependency(InternalFactHandle handle,
Object value,
Activation activation,
PropagationContext context,
Rule rule,
ObjectTypeConf typeConf)
throws FactException
- Adds a justification for the FactHandle to the justifiedMap.
- Parameters:
handle - activation - context - rule - typeConf -
- Throws:
FactException
addLogicalDependency
public void addLogicalDependency(InternalFactHandle handle,
Object value,
Activation activation,
PropagationContext context,
Rule rule,
ObjectTypeConf typeConf)
throws FactException
- Throws:
FactException
addLogicalDependency
public void addLogicalDependency(InternalFactHandle handle,
Object value,
Activation activation,
PropagationContext context,
Rule rule,
ObjectTypeConf typeConf,
boolean read)
throws FactException
- Throws:
FactException
clear
public void clear()
newTMSbeliefSet
public BeliefSet newTMSbeliefSet()
Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.