|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jess.Rete
The central class in the Jess library. Executes the built Rete network, and coordinates many other activities. Rete is basically a facade for all the other classes in the Jess library.
The jess.Rete class is the rule engine itself. Each jess.Rete object has its own working memory, agenda, rules, etc. To embed Jess in a Java application, you'll simply need to create one or more jess.Rete objects and manipulate them appropriately.
(C) 2005 Sandia National Laboratories
Field Summary | |
static int |
ACTIVATE
Constant passed to setEvalSalience() to indicate that dynamic salience expressions should be evaluated whenever a rule is activated. |
static int |
EVERY_TIME
Constant passed to setEvalSalience() to indicate that dynamic salience expressions should be evaluated before every rule is fired. |
static int |
INSTALL
Constant passed to setEvalSalience() to indicate that dynamic salience expressions should be evaluated only when a rule is installed (the default.) |
Constructor Summary | |
Rete()
Construct a single rule engine instance. |
|
Rete(java.applet.Applet applet)
Construct a single rule engine instance for use in an applet. |
|
Rete(java.lang.Object appObject)
|
Method Summary | |
protected void |
aboutToFire(Activation a)
Allows a subclass to be notified immediately before a rule fires. |
void |
add(java.lang.Object o)
Add an object to working memory using various defaults. |
void |
addAll(java.util.Collection c)
Add a collection of objects to working memory. |
void |
addAll(java.util.Iterator it)
Add a collection of objects to working memory. |
void |
addDebugListener(JessListener jel)
Add a listener so that it will receive debug events. |
Deffacts |
addDeffacts(Deffacts df)
Add a deffacts construct to this rule engine. |
Defglobal |
addDefglobal(Defglobal dg)
Creates a new Defglobal in this rule engine. |
java.util.List |
addDefglobals(java.util.List dg)
Adds a list of Defglobals to this object, as if by addDefglobal(). |
void |
addDefmodule(Defmodule module)
Define a new module, which becomes current. |
void |
addDefmodule(java.lang.String name)
Deprecated. As of Jess 7, use addDefmodule(Defmodule). |
void |
addDefmodule(java.lang.String name,
java.lang.String comment)
Deprecated. As of Jess 7, use addDefmodule(Defmodule). |
HasLHS |
addDefrule(HasLHS dr)
Add a rule or query to this engine. |
Deftemplate |
addDeftemplate(Deftemplate dt)
Creates a new deftemplate in this rule engine. |
void |
addInputRouter(java.lang.String s,
java.io.Reader is,
boolean consoleLike)
Add an "input router" to this object. |
void |
addJessListener(JessListener jel)
|
void |
addOutputRouter(java.lang.String s,
java.io.Writer os)
Add an "output router" to this object. |
Userfunction |
addUserfunction(Userfunction uf)
Creates a new function in this rule engine. |
Userpackage |
addUserpackage(Userpackage up)
Add a Userpackage to this engine. |
Fact |
assertFact(Fact f)
Assert a fact. |
Fact |
assertFact(Fact f,
Context c)
Assert a fact, using the given execution context. |
Fact |
assertString(java.lang.String s)
Assert a fact, as a String, using the global execution context. |
Fact |
assertString(java.lang.String s,
Context c)
Assert a fact, as a String. |
Value |
batch(java.lang.String filename)
Execute a file of Jess language code or JessML code. |
void |
bload(java.io.InputStream is)
Read this object's state from the given stream. |
void |
bsave(java.io.OutputStream os)
Save this object's state out to the given stream. |
void |
clear()
Reinitializes this rule engine. |
void |
clearFocusStack()
Empty the module focus stack. |
void |
clearStorage()
Clear the storage used by store() and fetch(). |
boolean |
containsObject(java.lang.Object o)
Indicates whether a given object is being held in working memory. |
int |
countQueryResults(java.lang.String name,
ValueVector params)
Invoke the named query and return the count of matching results. |
int |
countQueryResults(java.lang.String name,
ValueVector params,
Context context)
Invoke the named query and return the count of matching results. |
Deftemplate |
createDeftemplate(java.lang.String name)
Find or create the deftemplate by the given name. |
Value |
defclass(java.lang.String jessName,
java.lang.String clazz,
java.lang.String parent)
Add a defclass definition (a deftemplate) to this engine. |
Value |
defclass(java.lang.String jessName,
java.lang.String clazz,
java.lang.String parent,
boolean includeMemberVariables)
Add a defclass definition (a deftemplate) to this engine. |
void |
defineFeature(java.lang.String name)
Register a named feature, as if by the "provide" function. |
Value |
definstance(java.lang.String jessTypename,
java.lang.Object object,
boolean dynamic)
Make a shadow fact for the given object and add it to working memory. |
Value |
definstance(java.lang.String jessTypename,
java.lang.Object object,
boolean dynamic,
Context context)
Make a shadow fact for the given object and add it to working memory. |
protected int |
doPreAssertionProcessing(Fact f)
This method is called as a Fact is about to be asserted. |
Value |
eval(java.lang.String cmd)
Evaluate a Jess expression in this engine's global context. |
Value |
eval(java.lang.String cmd,
Context context)
Evaluate a Jess expression in the given execution context. |
void |
eventHappened(JessEvent je)
Responds to a JessEvent by emitting "watch" messages. |
Value |
executeCommand(java.lang.String cmd)
Deprecated. Use eval() instead. |
Value |
executeCommand(java.lang.String cmd,
Context context)
Deprecated. Use eval() instead. |
Value |
fetch(java.lang.String name)
Retrieve an object previously stored with store(). |
java.lang.Class |
findClass(java.lang.String className)
Load a class using the active ClassLoader. |
Deffacts |
findDeffacts(java.lang.String name)
Return the named deffacts object. |
Defglobal |
findDefglobal(java.lang.String name)
Look up a defglobal by name. |
HasLHS |
findDefrule(java.lang.String name)
Find a defrule or defquery object with a certain name. |
Deftemplate |
findDeftemplate(java.lang.String name)
Find a deftemplate object with a certain name. |
Fact |
findFactByFact(Fact f)
Find a Fact object in working memory, given a Fact object that is identical to it. |
Fact |
findFactByID(int id)
Return a Fact object given its numeric fact-id. |
Userfunction |
findUserfunction(java.lang.String name)
Find a userfunction, if there is one by the given name. |
java.lang.Object |
getActivationSemaphore()
The monitor of the object returned from this method will be signalled whenever an activation appears. |
java.applet.Applet |
getApplet()
If this Rete object is part of an applet, and the applet was supplied as a constructor argument, then this method will return it. |
java.lang.Class |
getAppObjectClass()
Return the Class that represents the "app object" for this Rete. |
java.lang.ClassLoader |
getClassLoader()
Return the ClassLoader that will be used to find classes named in Jess ocde. |
java.lang.String |
getCurrentModule()
Return the name of the current module. |
java.io.PrintWriter |
getErrStream()
Return the WSTDERR router, where Jess sends error messages. |
int |
getEvalSalience()
Fetch the salience evaluation behaviour, which helps determine the priority of rule firing. |
int |
getEventMask()
Query the current value of the event mask. |
static Factory |
getFactory()
Return the Factory Jess will use to create Rete Tokens. |
java.lang.String |
getFocus()
Query the focus module. |
Context |
getGlobalContext()
Fetch the global execution context. |
boolean |
getInputMode(java.lang.String s)
See the Jess manual for a discussion of this method. |
java.io.Reader |
getInputRouter(java.lang.String s)
Return the Reader registered under a given router name. |
java.util.Iterator |
getObjects(Filter filter)
Return a subset of Java objects (definstances) in working memory. |
java.io.Writer |
getOutputRouter(java.lang.String s)
Return the Writer registered under a given router name. |
java.io.PrintWriter |
getOutStream()
Return the WSTDERR router, where Jess sends much of its standard output. |
boolean |
getResetGlobals()
Return the resetGlobals property. |
java.net.URL |
getResource(java.lang.String name)
Load a resource using the current ClassLoader's getResource() method. |
Strategy |
getStrategy()
Retrieve the Strategy object this engine is using to order activations on the agenda. |
java.util.List |
getSupportedFacts(Fact supporter)
Returns a list of Fact objects that receive logical support from the argument. |
java.util.List |
getSupportingTokens(Fact fact)
Returns a list of one or more jess.Token objects that provide logical support for this fact. |
Activation |
getThisActivation()
Get the activation record for the currently firing rule. |
java.lang.String |
getThisRuleName()
Find out the name of the currently firing rule. |
void |
halt()
Stop the engine from firing rules. |
void |
importClass(java.lang.String clazz)
Make a single class name available for use in unqualified form in Jess code. |
void |
importPackage(java.lang.String pack)
Make all the classes in a package available for use in unqualified form from Jess code. |
boolean |
isDebug()
Return whether the engine is in debug mode. |
boolean |
isFeatureDefined(java.lang.String name)
Return whether a feature name has been registered by the "provide" function. |
boolean |
isHalted()
Returns true if halt has been called since the last run() call. |
java.lang.Class |
javaClassForDefclass(java.lang.String name)
Return the Java Class corresponding to a given Defclass name, or null if the name was not found. |
protected void |
justFired(Activation a)
Allows a subclass to be notified immediately after a rule fires. |
java.util.Iterator |
listActivations()
Return an Iterator over all the activiations for the current module. |
java.util.Iterator |
listActivations(java.lang.String moduleName)
Return an Iterator over all the activiations for the named module. |
java.util.Iterator |
listDebugListeners()
Return an iterator over all listeners that will receive debug events. |
java.util.Iterator |
listDefclasses()
Return an Iterator over all the names of all defclasses. |
java.util.Iterator |
listDeffacts()
Return an Iterator over all the deffacts in this engine. |
java.util.Iterator |
listDefglobals()
Return an Iterator over all the defglobals in this engine. |
java.util.Iterator |
listDefinstances()
Return an Iterator over all the Java objects currently represented by shadow facts in working memory. |
java.util.Iterator |
listDefrules()
Return an Iterator over all the defrules in this engine. |
java.util.Iterator |
listDeftemplates()
Return an Iterator over all the deftemplates in this engine, both explicit and implied. |
java.util.Iterator |
listFacts()
Return an Iterator over all the facts currently in working memory. |
java.util.Iterator |
listFocusStack()
Iterate over the module focus stack, from bottom to top. |
java.util.Iterator |
listFunctions()
Return an Iterator over all user-defined functions and deffunctions in this engine. |
java.util.Iterator |
listJessListeners()
|
java.util.Iterator |
listModules()
List all modules. |
static LineNumberRecord |
lookupFunction(Funcall fc)
Return information about the source location of a given function call, if known. |
WorkingMemoryMarker |
mark()
Return a marker for the current state of working memory. |
Fact |
modify(Fact fact,
java.lang.String[] slotNames,
Value[] slotValues)
Modify any number of slots in a fact. |
Fact |
modify(Fact fact,
java.lang.String[] slotNames,
Value[] slotValues,
Context context)
Modify any number of slots in a fact. |
Fact |
modify(Fact fact,
java.lang.String slotName,
Value slotValue)
Modify one slot in a fact. |
Fact |
modify(Fact fact,
java.lang.String slotName,
Value slotValue,
Context context)
Modify one slot in a fact. |
Activation |
peekNextActivation()
Return the next activation record from the agenda. |
java.lang.String |
popFocus(java.lang.String expected)
Remove the top module from the focus stack, and return it. |
void |
ppFacts(java.lang.String head,
java.io.Writer output)
Pretty-print all the facts with the given head to the Writer. |
void |
ppFacts(java.io.Writer output)
Pretty-print all the facts in working memory to the Writer. |
static void |
recordFunction(Funcall fc,
LineNumberRecord lnr)
Note that a function is being called. |
static void |
recordFunction(Funcall fc,
java.lang.String fileName,
int lineno)
Note that a function is being called. |
void |
removeDebugListener(JessListener jel)
Remove a listener so that it will no longer receive debug events. |
void |
removeInputRouter(java.lang.String s)
Remove the named router from the engine. |
void |
removeJessListener(JessListener jel)
|
void |
removeOutputRouter(java.lang.String s)
Remove the named router from the engine. |
void |
removeUserDefinedFunctions()
Removes all user-defined functions from this engine. |
void |
removeUserfunction(java.lang.String name)
Remove any currently defined function by the given name. |
void |
reset()
Reset the rule engine. |
void |
resetToMark(WorkingMemoryMarker marker)
Restore working memory by retracting all facts asserted after the given marker was placed. |
java.lang.String |
resolveName(java.lang.String name)
Decorate the name with the current module name, if it doesn't already contain a module name. |
Fact |
retract(Fact f)
Retract a fact. |
Fact |
retractString(java.lang.String s)
Retract a fact represented as a string. |
int |
run()
Run the rule engine. |
int |
run(int max)
Run the rule engine. |
java.util.Iterator |
runQuery(java.lang.String name,
ValueVector params)
Deprecated. Since Jess 7.0, superceded by runQueryStar() |
java.util.Iterator |
runQuery(java.lang.String name,
ValueVector params,
Context context)
Deprecated. Since Jess 7.0, superceded by runQueryStar() |
QueryResult |
runQueryStar(java.lang.String name,
ValueVector params)
Invoke the named query and return the results. |
QueryResult |
runQueryStar(java.lang.String name,
ValueVector params,
Context context)
Invoke the named query and return the results. |
int |
runUntilHalt()
Run the rule engine until halt() is called. |
void |
setApplet(java.applet.Applet applet)
Notify this Rete object that it is part of an Applet. |
void |
setAppObject(java.lang.Object appObject)
Specify the "app object" for this Rete. |
void |
setClassLoader(java.lang.ClassLoader loader)
Specify the ClassLoader that will be used to load classes named in Jess code. |
java.lang.String |
setCurrentModule(java.lang.String name)
Change the current module. |
void |
setDebug(boolean debug)
Specify whether the engine should be in debug mode. |
void |
setEvalSalience(int method)
Set the salience evaluation behaviour. |
void |
setEventMask(int mask)
You can control which events this object will fire using this method. |
static void |
setFactory(Factory f)
Set the Factory Jess will use to create Rete Tokens. |
void |
setFocus(java.lang.String name)
Change the focus module. |
void |
setPassiveMode(boolean passiveMode)
Return whether the engine is in passive mode. |
void |
setPendingFact(Fact fact,
boolean assrt)
TODO Should this be public? |
void |
setResetGlobals(boolean reset)
Set the resetGlobals property. |
java.lang.String |
setStrategy(Strategy s)
Tell this engine to use the given Strategy object to order the rules on the agenda. |
java.lang.String |
setWatchRouter(java.lang.String s)
Sets the router the "watch" facility will use for output. |
Value |
store(java.lang.String name,
java.lang.Object val)
Store a value in the engine under a given name for later retrieval by fetch. |
Value |
store(java.lang.String name,
Value val)
Store a value in the engine under a given name for later retrieval. |
java.lang.String |
toString()
Returns "[Rete]". |
Value |
unDeffacts(java.lang.String name)
Remove a deffacts from the engine. |
Fact |
undefinstance(java.lang.Object object)
Remove the given object from working memory. |
Value |
unDefrule(java.lang.String name)
Remove a rule or query from this Rete object. |
void |
unwatch(int which)
Cancel some debugging information. |
void |
unwatchAll()
Cancel all debugging info. |
Value |
updateObject(java.lang.Object object)
Bring a shadow fact up to date. |
Value |
updateObject(java.lang.Object object,
java.lang.String slotName)
Bring one slot of a shadow fact up to date. |
void |
verifyModule(java.lang.String moduleName)
Throw an exception if the argument isn't the name of a module. |
void |
waitForActivations()
Waits on the activation lock as long as the agenda is empty. |
void |
watch(int which)
Produce some debugging information. |
void |
watchAll()
Produce all possible debugging info. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int INSTALL
public static final int ACTIVATE
public static final int EVERY_TIME
Constructor Detail |
public Rete()
public Rete(java.applet.Applet applet)
applet
- If this Rete object is being created inside
an applet, pass it as an argument.public Rete(java.lang.Object appObject)
Method Detail |
public void addInputRouter(java.lang.String s, java.io.Reader is, boolean consoleLike)
s
- the router nameis
- a Reader where the router's data comes fromconsoleLike
- see the Jess manualpublic void removeInputRouter(java.lang.String s)
s
- the name of the router to removepublic java.io.Reader getInputRouter(java.lang.String s)
s
- the router name
public void addOutputRouter(java.lang.String s, java.io.Writer os)
s
- the router nameos
- where the data should gopublic void removeOutputRouter(java.lang.String s)
s
- the name of the routerpublic boolean getInputMode(java.lang.String s)
s
- the router name
public java.io.Writer getOutputRouter(java.lang.String s)
s
- The router name
public java.io.PrintWriter getErrStream()
public java.io.PrintWriter getOutStream()
protected int doPreAssertionProcessing(Fact f) throws JessException
f
- a Fact about to be asserted
JessException
public void clear() throws JessException
JessException
- if anything goes wrongpublic void setPendingFact(Fact fact, boolean assrt)
public void reset() throws JessException
JessException
- if anything goes wrongpublic Fact assertString(java.lang.String s, Context c) throws JessException
s
- a String representing a factc
- an execution context for resolving variables
JessException
- if something goes wrongpublic Fact assertString(java.lang.String s) throws JessException
s
- a String representing a fact
JessException
- if something goes wrongpublic Fact assertFact(Fact f) throws JessException
f
- a Fact object.
JessException
- if anything goes wrongpublic Fact assertFact(Fact f, Context c) throws JessException
f
- a Fact object.c
- an execution context
JessException
- if anything goes wrongpublic Fact retractString(java.lang.String s) throws JessException
s
- a String form of a Fact
JessException
public Fact retract(Fact f) throws JessException
f
- a Fact object
JessException
- if anything goes wrongpublic Fact modify(Fact fact, java.lang.String slotName, Value slotValue) throws JessException
fact
- a fact that's currently in working memoryslotName
- the name of a slot in the factslotValue
- a new value for the named slot
JessException
- if the slot name is bad or any other error occurspublic Fact modify(Fact fact, java.lang.String slotName, Value slotValue, Context context) throws JessException
fact
- a fact that's currently in working memoryslotName
- the name of a slot in the factslotValue
- a new value for the named slotcontext
- an execution context
JessException
- if the slot name is bad or any other error occurspublic Fact modify(Fact fact, java.lang.String[] slotNames, Value[] slotValues) throws JessException
fact
- a fact that's currently in working memoryslotNames
- the names of some slots in the factslotValues
- new values for the named slots
JessException
- if any slot name is bad or any other error occurspublic Fact modify(Fact fact, java.lang.String[] slotNames, Value[] slotValues, Context context) throws JessException
fact
- a fact that's currently in working memory.slotNames
- the names of some slots in the factslotValues
- new values for the named slots.context
- the execution context
JessException
- if any slot name is bad or any other error occursypublic Fact findFactByID(int id) throws JessException
id
- the fact-id
JessException
- if something goes wrongpublic Fact findFactByFact(Fact f) throws JessException
f
- a fact
JessException
- if something goes wrongpublic WorkingMemoryMarker mark()
resetToMark(WorkingMemoryMarker)
public void resetToMark(WorkingMemoryMarker marker) throws JessException
marker
- the marker
JessException
- if anything goes wrongmark()
public java.util.Iterator getObjects(Filter filter)
Filter.accept(java.lang.Object)
method returns true.
filter
- a filter to apply to working memory
public void ppFacts(java.lang.String head, java.io.Writer output) throws java.io.IOException
head
- the name or "head" of the facts of interestoutput
- the Writer to send the data to
java.io.IOException
- if anything goes wrongpublic void ppFacts(java.io.Writer output) throws java.io.IOException
output
- the Writer to send the data to
java.io.IOException
- if anything goes wrongpublic java.util.Iterator listDeffacts()
public Deffacts findDeffacts(java.lang.String name)
name
- the name of a deffacts construct
public java.util.Iterator listDeftemplates()
public java.util.Iterator listDefrules()
public java.util.Iterator listFacts()
public java.util.Iterator listDefinstances()
public boolean containsObject(java.lang.Object o)
o
- the object
public java.util.Iterator listDefclasses()
findDeftemplate(java.lang.String)
,
javaClassForDefclass(java.lang.String)
public java.util.Iterator listDefglobals()
public java.util.Iterator listFunctions()
public final HasLHS findDefrule(java.lang.String name)
name
- the name
public java.lang.Class javaClassForDefclass(java.lang.String name)
name
- the name of a defclass
public Deftemplate findDeftemplate(java.lang.String name) throws JessException
name
- the name
JessException
public Deftemplate createDeftemplate(java.lang.String name) throws JessException
name
- the "head" of the template
JessException
- if the template name is invalidpublic Deftemplate addDeftemplate(Deftemplate dt) throws JessException
dt
- a new Deftemplate
JessException
- if the deftemplate is already definedpublic Deffacts addDeffacts(Deffacts df) throws JessException
df
- a new Deffacts object
JessException
- If an error occurs during event broadcastingpublic Defglobal addDefglobal(Defglobal dg) throws JessException
dg
- a new Defglobal object
JessException
- if an error occurspublic java.util.List addDefglobals(java.util.List dg) throws JessException
dg
- a List of Defglobals
JessException
- if an error occurspublic Defglobal findDefglobal(java.lang.String name)
name
- the name of the defglobal
public void removeUserDefinedFunctions()
public Userfunction addUserfunction(Userfunction uf)
uf
- a new Userfunction
public void removeUserfunction(java.lang.String name)
name
- the name of the function to removepublic Userpackage addUserpackage(Userpackage up)
up
- the package object
public final Userfunction findUserfunction(java.lang.String name)
name
- the name of the function
public final HasLHS addDefrule(HasLHS dr) throws JessException
dr
- a Defrule or Defquery
JessException
- if anything goes wrongpublic final Value unDeffacts(java.lang.String name)
name
- the name of an existing deffacts construct, or "*"
public final Value unDefrule(java.lang.String name) throws JessException
name
- the name of the rule or query
JessException
- if anything goes wrongpublic void addDefmodule(Defmodule module) throws JessException
module
- a new Defmodule object
JessException
public void addDefmodule(java.lang.String name) throws JessException
JessException
public void addDefmodule(java.lang.String name, java.lang.String comment) throws JessException
JessException
public java.lang.String getCurrentModule()
public java.lang.String setCurrentModule(java.lang.String name) throws JessException
name
- the name of the new current module
JessException
- if the name is not a modulepublic java.util.Iterator listModules() throws JessException
JessException
public java.lang.String getFocus()
public void setFocus(java.lang.String name) throws JessException
name
- the module that should get focus
JessException
public java.util.Iterator listFocusStack() throws JessException
JessException
public void clearFocusStack()
public java.lang.String popFocus(java.lang.String expected) throws JessException
expected
- the expected module, or null
JessException
public void verifyModule(java.lang.String moduleName) throws JessException
moduleName
- a proposed module name
JessException
public java.lang.String resolveName(java.lang.String name)
name
- a module namepublic java.util.Iterator listActivations()
public java.util.Iterator listActivations(java.lang.String moduleName) throws JessException
moduleName
- the name of a module
JessException
- if the module name is invalidActivation.isInactive()
public Activation peekNextActivation() throws JessException
JessException
- if anything goes wrongpublic java.lang.Object getActivationSemaphore()
waitForActivations()
public void waitForActivations()
getActivationSemaphore()
public java.lang.String setStrategy(Strategy s) throws JessException
s
- the new conflict resolution strategy
JessException
public Strategy getStrategy()
public final void setEvalSalience(int method) throws JessException
method
- One of the acceptable values
JessException
- If something goes wrongpublic final int getEvalSalience()
setEvalSalience(int)
public int run() throws JessException
JessException
- if anything goes wrongprotected void aboutToFire(Activation a)
a
- the activation record for the about-to-fire ruleprotected void justFired(Activation a)
a
- the activation record for the just-fired rulepublic int run(int max) throws JessException
max
- the maximum number of rules to fire
JessException
- if anything goes wrongpublic int runUntilHalt() throws JessException
JessException
- if an error occurspublic void halt() throws JessException
JessException
- if an error occurs during event propagationpublic boolean isHalted()
public java.lang.String getThisRuleName()
getThisActivation()
public Activation getThisActivation()
getThisRuleName()
public void addJessListener(JessListener jel)
public void removeJessListener(JessListener jel)
public java.util.Iterator listJessListeners()
public int getEventMask()
setEventMask(int)
public void setEventMask(int mask)
JessEvent
class. By default, the event mask is 0 and no
events are sent.
mask
- the new event maskgetEventMask()
public void setPassiveMode(boolean passiveMode)
passiveMode
- the desired value of this propertypublic boolean isDebug()
public void setDebug(boolean debug)
debug
- the desired statepublic static void recordFunction(Funcall fc, java.lang.String fileName, int lineno)
fc
- the funcall being invokedfileName
- the source file namelineno
- the source file line numberpublic static void recordFunction(Funcall fc, LineNumberRecord lnr)
fc
- the funcall being invokedlnr
- the source file name and line numberpublic static LineNumberRecord lookupFunction(Funcall fc)
fc
- the funcall
public void removeDebugListener(JessListener jel)
jel
- the listener to removepublic void addDebugListener(JessListener jel)
jel
- the listener to removepublic java.util.Iterator listDebugListeners()
public void bload(java.io.InputStream is) throws java.io.IOException, java.lang.ClassNotFoundException
is
- an InputStream
java.io.IOException
java.lang.ClassNotFoundException
public void bsave(java.io.OutputStream os) throws java.io.IOException
os
- an OutputStream
java.io.IOException
public Value definstance(java.lang.String jessTypename, java.lang.Object object, boolean dynamic) throws JessException
jessTypename
- the name of a defclassobject
- a Java object of the defclass's typedynamic
- true if PropertyChangeListeners should be used
JessException
- if anything goes wrongpublic Value definstance(java.lang.String jessTypename, java.lang.Object object, boolean dynamic, Context context) throws JessException
jessTypename
- the name of a defclassobject
- a Java object of the defclass's typedynamic
- true if PropertyChangeListeners should be usedcontext
- used for asserting the fact
JessException
- if anything goes wrongpublic Fact undefinstance(java.lang.Object object) throws JessException
object
- an object currently represented in working memory.
JessException
- if object isn't a definstanced object, or on errorpublic Value updateObject(java.lang.Object object) throws JessException
object
- a previously definstanced object
JessException
- if object isn't a definstanced object, or on errorpublic Value updateObject(java.lang.Object object, java.lang.String slotName) throws JessException
object
- a previously definstanced objectslotName
- the name of a property of that object
JessException
- if object isn't a definstanced object, or on errorpublic void add(java.lang.Object o) throws JessException
o
- an object to add to working memory
JessException
- if anything goes wrongpublic void addAll(java.util.Collection c) throws JessException
c
- a collection of objects to be added to working memory
JessException
- if anything goes wrongadd(Object)
public void addAll(java.util.Iterator it) throws JessException
it
- Iterator over a collection of objects to be added to working memory
JessException
- if anything goes wrongadd(Object)
public Value defclass(java.lang.String jessName, java.lang.String clazz, java.lang.String parent, boolean includeMemberVariables) throws JessException
jessName
- the name Jess should use for this defclassclazz
- the name of the Java classparent
- if non-null, a parent deftemplate or defclass nameincludeMemberVariables
- if true, slots corresponding to
public member variables are created.
JessException
public Value defclass(java.lang.String jessName, java.lang.String clazz, java.lang.String parent) throws JessException
jessName
- The name Jess should use for this defclassclazz
- The name of the Java classparent
- If non-null, a parent deftemplate or defclass name
JessException
public final Context getGlobalContext()
public Value eval(java.lang.String cmd) throws JessException
Rete r = new Rete(); r.eval("(deffunction square (?n) (return (* ?n ?n)))"); Value v = r.eval("(square 3)"); int nine = v.intValue(r.getGlobalContext()));
Note that you may only pass one function call or construct at a time to eval().
cmd
- a string containing a Jess expression
JessException
- if anything goes wrongpublic Value executeCommand(java.lang.String cmd) throws JessException
cmd
- a string containing a Jess expression
JessException
- if anything goes wrongeval(String)
public Value eval(java.lang.String cmd, Context context) throws JessException
Rete r = new Rete(); r.eval("(deffunction square (?n) (return (* ?n ?n)))"); Value v = r.eval("(square 3)"); int nine = v.intValue(r.getGlobalContext()));
Note that you may only pass one function call or construct at a time to eval().
cmd
- a string containing a Jess expressioncontext
- the evaluation context
JessException
- if anything goes wrongpublic Value executeCommand(java.lang.String cmd, Context context) throws JessException
cmd
- a string containing a Jess expressioncontext
- the evaluation context
JessException
- if anything goes wrongeval(String)
public final void setResetGlobals(boolean reset)
reset
- The value of this propertypublic final boolean getResetGlobals()
public Value store(java.lang.String name, Value val)
name
- a key under which to save the valueval
- the value to store
fetch(java.lang.String)
public Value store(java.lang.String name, java.lang.Object val)
name
- a key under which to file the valueval
- the value to store
fetch(java.lang.String)
public Value fetch(java.lang.String name)
name
- the key under which to find an object
store(java.lang.String, jess.Value)
public void clearStorage()
public static Factory getFactory()
public static void setFactory(Factory f)
f
- a jess.Factory implementationpublic Value batch(java.lang.String filename) throws JessException
filename
- the name of a file or resource
JessException
- if there are I/O problems, or syntax errors in the fileBatch.batch(java.lang.String, jess.Rete)
public QueryResult runQueryStar(java.lang.String name, ValueVector params) throws JessException
name
- the name of the queryparams
- the query's parameters
JessException
- if anything goes wrongpublic QueryResult runQueryStar(java.lang.String name, ValueVector params, Context context) throws JessException
name
- the name of the queryparams
- the query's parameters
JessException
- if anything goes wrongpublic java.util.Iterator runQuery(java.lang.String name, ValueVector params) throws JessException
name
- the name of the queryparams
- the query's parameters
JessException
- if anything goes wrongpublic java.util.Iterator runQuery(java.lang.String name, ValueVector params, Context context) throws JessException
name
- the name of the queryparams
- the query's parameters
JessException
- if anything goes wrongpublic int countQueryResults(java.lang.String name, ValueVector params) throws JessException
name
- the name of the queryparams
- the query's parameters
JessException
- if anything goes wrongpublic int countQueryResults(java.lang.String name, ValueVector params, Context context) throws JessException
name
- the name of the queryparams
- the query's parameterscontext
- an execution context
JessException
- if anything goes wrongpublic void watch(int which) throws JessException
which
- one of the constants in WatchConstants
JessException
- if the argument is invalidWatchConstants
public void unwatch(int which) throws JessException
which
- one of the constants in WatchConstants
JessException
- if the argument is invalidWatchConstants
public void watchAll()
public void unwatchAll()
public void eventHappened(JessEvent je)
eventHappened
in interface JessListener
je
- An event objectpublic java.lang.String setWatchRouter(java.lang.String s) throws JessException
s
- the name of the router to use
JessException
- if the router doesn't existpublic void defineFeature(java.lang.String name)
name
- the name of the featurepublic boolean isFeatureDefined(java.lang.String name)
name
- the name of the feature
public java.util.List getSupportingTokens(Fact fact)
fact
- a fact of interest
Token
,
Token.fact(int)
,
Token.size()
public java.util.List getSupportedFacts(Fact supporter)
supporter
- a fact of interest
public java.applet.Applet getApplet()
public java.lang.Class getAppObjectClass()
public void setApplet(java.applet.Applet applet)
applet
- the Appletpublic void setAppObject(java.lang.Object appObject)
appObject
- the "app object".public void setClassLoader(java.lang.ClassLoader loader)
loader
- the ClassLoader to usepublic java.lang.ClassLoader getClassLoader()
public java.lang.Class findClass(java.lang.String className) throws java.lang.ClassNotFoundException
className
- the name of the class
java.lang.ClassNotFoundException
- if the class could not be loadedpublic java.net.URL getResource(java.lang.String name)
name
- the name of the resource
public void importPackage(java.lang.String pack)
pack
- the name of a Java packagepublic void importClass(java.lang.String clazz) throws JessException
clazz
- the fully-qualified name of the class
JessException
- if the class is not foundpublic java.lang.String toString()
|
© 2006 Sandia Corporation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |