org.drools
Interface WorkingMemory


public interface WorkingMemory

A knowledge session for a RuleBase.

Author:
bob mcwhirter

Method Summary
 FactHandle assertObject(java.lang.Object object)
          Aasert a fact.
 boolean containsObject(FactHandle handle)
          Determine if an object is associated with a FactHandle.
 void fireAllRules()
          Fire all items on the agenda until empty.
 java.lang.Object getApplicationData()
          Retrieve the application data that is associated with this memory.
 java.lang.Object getObject(FactHandle handle)
          Retrieve the object associated with a FactHandle.
 java.util.List getObjects()
          Retieve all known objects.
 RuleBase getRuleBase()
          Retrieve the RuleBase of this working memory.
 void modifyObject(FactHandle handle, java.lang.Object object)
          Modify a fact.
 void retractObject(FactHandle handle)
          Retract a fact.
 void setApplicationData(java.lang.Object appData)
          Set the application data associated with this memory.
 

Method Detail

getApplicationData

public java.lang.Object getApplicationData()
Retrieve the application data that is associated with this memory.

Returns:
The application data or null if no data has been set for this memory.

setApplicationData

public void setApplicationData(java.lang.Object appData)
Set the application data associated with this memory.

Parameters:
appData - The application data for this memory.

getRuleBase

public RuleBase getRuleBase()
Retrieve the RuleBase of this working memory.

Returns:
The RuleBase.

fireAllRules

public void fireAllRules()
                  throws FactException
Fire all items on the agenda until empty.

Throws:
FactException - If an error occurs.

getObject

public java.lang.Object getObject(FactHandle handle)
                           throws NoSuchFactObjectException
Retrieve the object associated with a FactHandle.

Parameters:
handle - The fact handle.
Returns:
The associated object.
Throws:
NoSuchFactObjectException - If no object is known to be associated with the specified handle.
See Also:
containsObject(org.drools.FactHandle)

getObjects

public java.util.List getObjects()
Retieve all known objects.

Returns:
The list of all known objects.

containsObject

public boolean containsObject(FactHandle handle)
Determine if an object is associated with a FactHandle.

Parameters:
handle - The fact handle.
Returns:
true if an object is known to be associated with the specified handle, otherwise false.

assertObject

public FactHandle assertObject(java.lang.Object object)
                        throws FactException
Aasert a fact.

Parameters:
object - The fact object.
Returns:
The new fact-handle associated with the object.
Throws:
FactException - If an error occurs.

retractObject

public void retractObject(FactHandle handle)
                   throws FactException
Retract a fact.

Parameters:
handle - The fact-handle associated with the fact to retract.
Throws:
FactException - If an error occurs.

modifyObject

public void modifyObject(FactHandle handle,
                         java.lang.Object object)
                  throws FactException
Modify a fact.

Parameters:
handle - The fact-handle associated with the fact to modify.
object - The new value of the fact.
Throws:
FactException - If an error occurs.