|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jess.ValueVector jess.Funcall
jess.Funcall is a specialized subclass of
ValueVector
that represents a Jess function call. It contains
the name of the function, an internal pointer to the actual
Userfunction
object containing the function code, and
the arguments to pass to the function.
You can call Jess functions using Funcall if you prefer,
rather than using Rete.eval(java.lang.String)
This method
has somewhat less overhead since there is no parsing to be done, but of course
it's less convenient.
Rete r = new Rete(); // The following is equivalent to the Jess code // (defclass dimension "java.awt.Dimension") Funcall f = new Funcall("defclass", r); f.arg("dimension").arg("java.awt.Dimension"); f.execute(r.getGlobalContext());
The first entry in a Funcall's ValueVector is the
name of the function, even though you don't explicitly set
it. Changing the first entry will not automatically change the
function the Funcall will call! On the other hand, redefining
a function in the Rete
object a Funcall is tied to will
cause the Funcall to call the new function.
The Funcall class also contains some public static constant Value member objects that represent the special symbols nil, TRUE, FALSE, EOF, etc. You are encouraged to use these.
(C) 2006 Sandia National Laboratories
FuncallValue
,
Serialized FormField Summary | |
static Value |
CRLF
The object representing a newline to printout |
static Value |
EOF
The object representing end-of-file |
static Value |
FALSE
The object representing the value FALSE |
static Value |
NIL
The object representing the value NIL |
static Value |
NILLIST
An object representing an empty list. |
static Value |
T
The object representing printout's standard router |
static Value |
TRUE
The object representing the value TRUE |
Fields inherited from class jess.ValueVector |
m_ptr, m_v |
Constructor Summary | |
Funcall(java.lang.String name,
Rete engine)
Create a Funcall given the name. |
Method Summary | |
java.lang.Object |
accept(Visitor v)
A proper accept() implementation should call one of the visitXXX() methods on the Visitor. |
Funcall |
arg(double f)
Calls ValueVector.add(jess.Value) , then returns this object. |
Funcall |
arg(Funcall f)
Calls ValueVector.add(jess.Value) , then returns this object. |
Funcall |
arg(int i)
Calls ValueVector.add(jess.Value) , then returns this object. |
Funcall |
arg(long l)
Calls ValueVector.add(jess.Value) , then returns this object. |
Funcall |
arg(java.lang.Object o)
Calls ValueVector.add(jess.Value) , then returns this object. |
Funcall |
arg(java.lang.String s)
Calls ValueVector.add(jess.Value) , then returns this object. |
Funcall |
arg(Value v)
Calls ValueVector.add(jess.Value) , then returns this object. |
java.lang.Object |
clone()
Copies a Funcall |
Funcall |
cloneInto(Funcall vv)
Makes the argument into a copy of this Funcall. |
Value |
execute(Context context)
Execute this funcall in a particular context. |
Value |
get(int i)
A version of ValueVector.get with more appropriate error messages. |
java.lang.String |
getName()
Returns the name of the function this Funcall will invoke |
Userfunction |
getUserfunction(Rete engine)
Returns the Userfunction object this Funcall would invoke if it were invoked now, |
static java.util.Iterator |
listIntrinsics()
Lists all the functions built into this version of Jess. |
java.lang.String |
toString()
Formats a Funcall as a String |
java.lang.String |
toStringWithParens()
Just calls toString() |
Methods inherited from class jess.ValueVector |
add, add, add, add, add, add, add, addAll, addAll, cloneInto, copy, equals, hashCode, remove, set, setLength, size |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static Value TRUE
public static Value FALSE
public static Value NIL
public static Value NILLIST
public static Value EOF
public static Value CRLF
public static Value T
Constructor Detail |
public Funcall(java.lang.String name, Rete engine) throws JessException
name
- The name of the functionengine
- The Rete engine where the function is defined
JessException
- If something goes wrong.Method Detail |
public java.lang.String toString()
toString
in class ValueVector
public java.lang.String toStringWithParens()
toString()
toStringWithParens
in class ValueVector
public static java.util.Iterator listIntrinsics()
public java.lang.String getName()
public java.lang.Object clone()
clone
in class ValueVector
public Funcall cloneInto(Funcall vv)
vv
- The Funcall into which the copy should be made
public Value execute(Context context) throws JessException
context
- An execution context for the function
JessException
- If something goes wrongpublic Userfunction getUserfunction(Rete engine) throws JessException
engine
- the Rete object that will supply the execution context
JessException
public Funcall arg(Value v)
ValueVector.add(jess.Value)
, then returns this object. This method does the same thing as
add but returns this Funcall as a Funcall so the last call in a chain can be
a call to execute(jess.Context)
.
v
- An argument to add to this Funcall
ValueVector.add(jess.Value)
public Funcall arg(java.lang.String s) throws JessException
ValueVector.add(jess.Value)
, then returns this object. This method does the same thing as
add but returns this Funcall as a Funcall so the last call in a chain can be
a call to execute(jess.Context)
.
s
- An argument to add to this Funcall, interpreted as a symbol
JessException
ValueVector.add(jess.Value)
public Funcall arg(int i) throws JessException
ValueVector.add(jess.Value)
, then returns this object. This method does the same thing as
add but returns this Funcall as a Funcall so the last call in a chain can be
a call to execute(jess.Context)
.
i
- An argument to add to this Funcall, interpreted as an integer
JessException
ValueVector.add(jess.Value)
public Funcall arg(double f) throws JessException
ValueVector.add(jess.Value)
, then returns this object. This method does the same thing as
add but returns this Funcall as a Funcall so the last call in a chain can be
a call to execute(jess.Context)
.
f
- An argument to add to this Funcall, interpreted as an integer
JessException
ValueVector.add(jess.Value)
public Funcall arg(long l) throws JessException
ValueVector.add(jess.Value)
, then returns this object. This method does the same thing as
add but returns this Funcall as a Funcall so the last call in a chain can be
a call to execute(jess.Context)
.
l
- An argument to add to this Funcall, interpreted as a long
JessException
ValueVector.add(jess.Value)
public Funcall arg(Funcall f) throws JessException
ValueVector.add(jess.Value)
, then returns this object. This method does the same thing as
add but returns this Funcall as a Funcall so the last call in a chain can be
a call to execute(jess.Context)
.
f
- An argument to add to this Funcall, interpreted as a function call
JessException
ValueVector.add(jess.Value)
public Funcall arg(java.lang.Object o) throws JessException
ValueVector.add(jess.Value)
, then returns this object. This method does the same thing as
add but returns this Funcall as a Funcall so the last call in a chain can be
a call to execute(jess.Context)
.
o
- An argument to add to this Funcall, interpreted as a Java object
JessException
ValueVector.add(jess.Value)
public Value get(int i) throws JessException
get
in class ValueVector
i
- The 0-based index of the Value to fetch
JessException
public java.lang.Object accept(Visitor v)
Visitable
accept
in interface Visitable
v
- a visitor to invoke
|
© 2007 Sandia Corporation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |