|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.drools.MockWorkingMemory
public class MockWorkingMemory
Constructor Summary | |
---|---|
MockWorkingMemory()
|
Method Summary | |
---|---|
void |
addEventListener(WorkingMemoryEventListener listener)
add event listener to listeners ArrayList |
FactHandle |
assertObject(Object object)
Assert a fact. |
FactHandle |
assertObject(Object object,
boolean dynamic)
Assert a fact registering JavaBean PropertyChangeListeners
on the Object to automatically trigger modifyObject calls
if dynamic is true . |
void |
clearAgenda()
Clear the Agenda |
boolean |
containsObject(FactHandle handle)
Determine if an object is associated with a FactHandle . |
void |
fireAllRules()
Fire all items on the agenda until empty. |
void |
fireAllRules(AgendaFilter agendaFilter)
Fire all items on the agenda until empty, using the given AgendaFiler |
Object |
getApplicationData(String name)
Retrieve a specific piece of application data by name |
Map |
getApplicationDataMap()
Retrieve all of the set application data in this memory |
List |
getEventListeners()
Returns a read-only list of listeners |
FactHandle |
getFactHandle(Object object)
Retrieve the FactHandle associated with an Object. |
List |
getFactHandles()
Retrieve all known Fact Handles. |
Object |
getObject(FactHandle handle)
Retrieve the object associated with a FactHandle . |
List |
getObjects()
Retrieve all known objects. |
List |
getObjects(Class cls)
Retrieve all known objects of the specified class. |
RuleBase |
getRuleBase()
Retrieve the RuleBase of this working memory. |
void |
modifyObject(FactHandle handle,
Object object)
Modify a fact. |
void |
removeEventListener(WorkingMemoryEventListener listener)
remove event listener from listeners ArrayList |
void |
retractObject(FactHandle handle)
Retract a fact. |
void |
setApplicationData(String name,
Object value)
Set a specific piece of application data in this working memory |
void |
setAsyncExceptionHandler(AsyncExceptionHandler handler)
Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockWorkingMemory()
Method Detail |
---|
public void addEventListener(WorkingMemoryEventListener listener)
addEventListener
in interface WorkingMemory
listener
- public void removeEventListener(WorkingMemoryEventListener listener)
removeEventListener
in interface WorkingMemory
listener
- public List getEventListeners()
getEventListeners
in interface WorkingMemory
public Map getApplicationDataMap()
getApplicationDataMap
in interface WorkingMemory
public void setApplicationData(String name, Object value)
setApplicationData
in interface WorkingMemory
name
- the name under which to populate the datavalue
- the application datapublic Object getApplicationData(String name)
getApplicationData
in interface WorkingMemory
public void clearAgenda()
clearAgenda
in interface WorkingMemory
public RuleBase getRuleBase()
WorkingMemory
RuleBase
of this working memory.
getRuleBase
in interface WorkingMemory
RuleBase
.public void fireAllRules() throws FactException
WorkingMemory
fireAllRules
in interface WorkingMemory
FactException
- If an error occurs.public void fireAllRules(AgendaFilter agendaFilter) throws FactException
WorkingMemory
fireAllRules
in interface WorkingMemory
FactException
- If an error occurs.public Object getObject(FactHandle handle) throws NoSuchFactObjectException
WorkingMemory
FactHandle
.
getObject
in interface WorkingMemory
handle
- The fact handle.
NoSuchFactObjectException
- If no object is known to be associated with the specified
handle.WorkingMemory.containsObject(org.drools.FactHandle)
public FactHandle getFactHandle(Object object) throws NoSuchFactHandleException
WorkingMemory
FactHandle
associated with an Object.
getFactHandle
in interface WorkingMemory
object
- The object.
NoSuchFactHandleException
- If no handle is known to be associated with the specified
object.WorkingMemory.containsObject(org.drools.FactHandle)
public List getObjects()
WorkingMemory
getObjects
in interface WorkingMemory
public List getObjects(Class cls)
WorkingMemory
getObjects
in interface WorkingMemory
cls
- The class of object to return.
public List getFactHandles()
WorkingMemory
getFactHandles
in interface WorkingMemory
public boolean containsObject(FactHandle handle)
WorkingMemory
FactHandle
.
containsObject
in interface WorkingMemory
handle
- The fact handle.
true
if an object is known to be associated with
the specified handle, otherwise false
.public FactHandle assertObject(Object object) throws FactException
WorkingMemory
assertObject
in interface WorkingMemory
object
- The fact object.
FactException
- If an error occurs.public FactHandle assertObject(Object object, boolean dynamic) throws FactException
WorkingMemory
PropertyChangeListeners
on the Object to automatically trigger modifyObject
calls
if dynamic
is true
.
assertObject
in interface WorkingMemory
object
- The fact object.dynamic
- true if Drools should add JavaBean
PropertyChangeListeners
to the object.
FactException
- If an error occurs.public void retractObject(FactHandle handle) throws FactException
WorkingMemory
retractObject
in interface WorkingMemory
handle
- The fact-handle associated with the fact to retract.
FactException
- If an error occurs.public void modifyObject(FactHandle handle, Object object) throws FactException
WorkingMemory
modifyObject
in interface WorkingMemory
handle
- The fact-handle associated with the fact to modify.object
- The new value of the fact.
FactException
- If an error occurs.public void setAsyncExceptionHandler(AsyncExceptionHandler handler)
WorkingMemory
setAsyncExceptionHandler
in interface WorkingMemory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |