ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.rules
Class AbleWorkingMemoryLib

java.lang.Object
  extended bycom.ibm.able.rules.AbleWorkingMemoryLib
All Implemented Interfaces:
java.io.Serializable

public class AbleWorkingMemoryLib
extends java.lang.Object
implements java.io.Serializable

This class provides a set of user-defined functions for manipulating an AbleWorkingMemory object in an AbleRuleSet.

See Also:
AbleWorkingMemory, AbleRuleSet, Serialized Form

Constructor Summary
AbleWorkingMemoryLib()
           
 
Method Summary
 void assertAll(AbleWorkingMemory wm, java.util.List theList)
          Assert all elements in the list into working memory.
 void assertFact(AbleWorkingMemory wm, java.lang.Object fact)
          Place a fact into the database
 void clear(AbleWorkingMemory wm)
          Clear all facts from the working memory
 boolean exists(AbleWorkingMemory wm, java.lang.Object fact)
          Test if the specified object exists in the working memory
 java.lang.Object find(AbleWorkingMemory wm, AbleSelector query)
          Find the first fact to match the query
 java.util.AbstractCollection findAll(AbleWorkingMemory wm, AbleSelector query)
          Find all facts that match the query
 java.util.AbstractCollection findAllInstances(AbleWorkingMemory wm, java.lang.String className)
          Find all objects that match the class
 void modify(AbleWorkingMemory wm, java.lang.Object fact)
          Modify or change an existing fact in the working memory
 void retract(AbleWorkingMemory wm, java.lang.Object fact)
          Remove a fact from the database
 void retractAll(AbleWorkingMemory wm, java.util.List theList)
          Retract all elements in the list from working memory.
 java.lang.String showWorkingMemory(AbleWorkingMemory wm)
          Returns a formatted string of the contents of the working memory to use for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbleWorkingMemoryLib

public AbleWorkingMemoryLib()
Method Detail

assertFact

public void assertFact(AbleWorkingMemory wm,
                       java.lang.Object fact)
Place a fact into the database

Parameters:
wm - The Working Memory.
fact - The Object to be asserted

assertAll

public void assertAll(AbleWorkingMemory wm,
                      java.util.List theList)
Assert all elements in the list into working memory. The list is unchanged.

Parameters:
wm - The Working Memory.
theList - The list from which elements are to be asserted.


retract

public void retract(AbleWorkingMemory wm,
                    java.lang.Object fact)
Remove a fact from the database

Parameters:
wm - The Working Memory.
fact - The Object to be removed

retractAll

public void retractAll(AbleWorkingMemory wm,
                       java.util.List theList)
Retract all elements in the list from working memory. The list is unchanged.

Parameters:
wm - The Working Memory.
theList - The list from which elements are to be retracted.


modify

public void modify(AbleWorkingMemory wm,
                   java.lang.Object fact)
Modify or change an existing fact in the working memory

Parameters:
wm - The Working Memory.
fact - The Object to be modified

clear

public void clear(AbleWorkingMemory wm)
Clear all facts from the working memory

Parameters:
wm - The Working Memory.

exists

public boolean exists(AbleWorkingMemory wm,
                      java.lang.Object fact)
Test if the specified object exists in the working memory

Parameters:
wm - The Working Memory.
fact - The object we are looking for in the working memory.
Returns:
true if the object was found, false otherwise

find

public java.lang.Object find(AbleWorkingMemory wm,
                             AbleSelector query)
                      throws AbleDataException
Find the first fact to match the query

Parameters:
wm - The Working Memory.
query - The AbleSelector used to query the working memory
Returns:
The first instance found
Throws:
AbleDataException

findAll

public java.util.AbstractCollection findAll(AbleWorkingMemory wm,
                                            AbleSelector query)
                                     throws AbleDataException
Find all facts that match the query

Throws:
AbleDataException

findAllInstances

public java.util.AbstractCollection findAllInstances(AbleWorkingMemory wm,
                                                     java.lang.String className)
                                              throws AbleDataException
Find all objects that match the class

Parameters:
wm - The Working Memory.
className - The name of the Java class instances to be found
Returns:
the matching instances (if any)
Throws:
AbleDataException

showWorkingMemory

public java.lang.String showWorkingMemory(AbleWorkingMemory wm)
Returns a formatted string of the contents of the working memory to use for debugging.


ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005