Well, first of all, this isn't quite how Java works. The line 

        Rete r2 = r1; 

makes r2 a copy of the -pointer- r1. Both variables refer to the same
Rete object afterwards.

The Rete class doesn't implement the clone() method or the Cloneable
interface, so there's no direct way to make a copy. I have no plans to
support this in the future, either.

What you could do in Jess 6.0a3 is use the bsave and bload commands to
create copies of a Rete object.

         Rete r1 = new Rete();
         r1.executeCommand("(batch /x.clp)");
         r1.executeCommand("(bsave myImage)");

         Rete r2 = new Rete();
         r2.executeCommand("(bload myImage"));
         
r2 is now a copy of r1, except for any open files or JessEvent
listeners you may have registered in r1. This is probably no faster
than simply reloading the rules into the new copy, but perhaps you
have something in mind besides speed.


I think chinnaswamy gounder wrote:
> Hi all,
> 
>        I plan to create a Rete manager for my rule
> engine and for that first I create a Rete object and
> load all the rules ( cluster ) to that.  After that if
> I make copies (cloning )of the Rete object, will it
> comes with the rules what I have loaded or I have to
> load the rules again. 
> 
>        Rete r1 = new Rete()
>        r1.executeCommand("(batch /x.clp)");
> 
>        Now I make a copy of r1 to r2
> 
>        Rete r2 = r1;
>        r2.run();
> 
> Will r2 work with the rule cluster x.clp or I have do
> anything else.
> 
> Please help me to clear idea on this issue.
> 
>      Thanks and regards
> 
>      Chinnaswamy
> 
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
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]
---------------------------------------------------------------------

Reply via email to