Re: JESS: FYI - using trees in Jess code

2004-08-02 Thread ejfried
I think Jason Morris wrote:
> 
> In fact, by using Swing's trees from my Jess code, I could attach a "user
> object" to each DefaultMutableTreeNode and manipulate it via
> getUserObject()/setUserObject().  In my case, the user object becomes a Jess
> fact reference (or anything else I want to stick in there).  Additionally, I
> could take advantage of other DefaultTreeModel methods like getPath(),
> getPathtoRoot(), and a whole host of useful query and enumeration methods,
> which I'd otherwise have to had written from scratch.
> 
> Jess really is the "programmer's rule engine"!
> 

Interesting. I never thought about using DefaultMutableTreeNode as a
data structure apart from Swing, but that's actually not a bad idea,
certainly for experimentation, anyway.

It will certainly be possible to use "accumulate" to populate trees
this way. 




-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov


To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]




JESS: FYI - using trees in Jess code

2004-08-01 Thread Jason Morris
Hi All,
I just wanted to squash my previous query about adding a native, general
purpose, tree storage mechanism to Jess.  It's not needed -- Jess's
flexibility lets you build pretty much anything you want.

For example, I successfully tried:

a) Cross-linking facts containing Jess multislots (like using relational
tables with foreign keys).  This seemed to be the "pure" Jess way, but I'd
had to roll all my own node manipulation functions.  Ernest mentions this in
passing in JIA.
b) Using java.util.LinkedList objects (again, I had to create all my own
accessors, but it's a well-documented implementation pattern)
c) Using javax.swing.tree.* with Jess script/API code.  Specifically use
DefaultTreeModel, DefaultMutableTreeNode, and JTree if you want to display
it.  Ironically, against my initial apprehension, this turned out to be the
simplest and cleanest choice for my application.

In fact, by using Swing's trees from my Jess code, I could attach a "user
object" to each DefaultMutableTreeNode and manipulate it via
getUserObject()/setUserObject().  In my case, the user object becomes a Jess
fact reference (or anything else I want to stick in there).  Additionally, I
could take advantage of other DefaultTreeModel methods like getPath(),
getPathtoRoot(), and a whole host of useful query and enumeration methods,
which I'd otherwise have to had written from scratch.

Jess really is the "programmer's rule engine"!

Cheers,

Jason



Jason Morris
Morris Technical Solutions
[EMAIL PROTECTED]
www.morristechnicalsolutions.com
fax/phone: 503.692.1088


To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]