An atom (a sub-command) and one or more additional arguments
Returns:
(Varies)
Description:
The bag command lets you manipulate Java hashtables from Jess.
The net result is that you can create any number of associative arrays
or property lists. Each such array or list has a name by which it can be
looked up. The lists can contain other lists as properties, or any other
Jess data type.
The bag command does different things based on its first argument.
It's really seven commands in one:
create accepts a String, the name of a new Bag to be created.
The bag object itself is returned. For example:
Jess> (bag create my-bag)
delete accepts the name of an existing bag, and deletes it from
the list of bags.
find accepts the name of a bag, and returns the corresponding
bag object, if one exists, or nil.
list returns a list of the names of all the existing bags, as
a multifield.
set accepts as arguments a bag, a String property name, and any
Jess value as its three arguments. The named property of the given bag
is set to the value, and the value is returned.
get accepts as arguments a bag and a String property name. The
named property is retrieved and returned, or nil if there is no
such property. For example:
Retrieves and returns any value previously stored by the
store function under the given
name, or nil if there is none. Analogous to the
fetch() member function of the Rete class. See
the section on using store and
fetch for details.
Returns a special unique sequenced value. Returns a unique atom which consists
of the letters gen plus an integer. Use setgen
to set the value of the integer to be used by the next gensym call.
External address, an object that implements the interface
jess.factory.Factory
Returns:
External address, an object that implements the interface
jess.factory.Factory; the previous value of this property.
Description:
Set the "thing factory" for the active Rete object. Providing an
alternate "thing factory" is a very advanced, and currently
undocumented, way to extend Jess's functionality.
Associates the expression with the name given by the first argument,
such that later calls to the fetch will retrieve
it. Storing the atom nil will clear any value associated with
name. Analagous to the store() member function of the
jess.Rete class. See section on
using store and fetch for more
details.
Sends a command to the operating system. Each atom or string becomes
one element of the argument array in a call to the Java
java.lang.Runtime.exec(String[] cmdaray) method; therefore to
execute the command edit myfile.txt, you should call
(system edit myfile.txt), not (system "edit myfile.txt").
Normally blocks (i.e., Jess stops until the applet returns), but if
the last argument is an ampersand (&), the program will
run in the background. The standard output and standard error streams
of the process are connected to the 't' router, but the input of the
process is not connected to the terminal.
Returns the Java Process object. You can call waitFor and then
exitValue to get the exit status of the process.