One way you could clone is to serialize the Rete object to an in-memory
array, then deserialize from that array as needed. It would be as fast as a
deep clone, maybe faster.
The trick is determining how big of an array you'd need, but that can be
determined by serializing to a file and counting the bytes. Add a few K
just for safety's sake.
The relevant classes are java.io.ByteArrayInputStream and
java.io.ByteArrayOutputStream.
-Matt Bishop
-----Original Message-----
From: Willie Wheeler
To: [EMAIL PROTECTED]
Sent: 02/27/2001 2:02 PM
Subject: JESS: Question about cloning Rete
Hi Ernest, or anyone who knows the answer, :-)
Earlier this month (2/8/01) a user asked how to clone a Rete
instance, and the answer was to bsave and bload. While this works for
my
application, it is a little slow. Ernest said that there is no
Rete.clone() and that he has no plans to support it. I am curious as to
the reason--is it that performance would be no better than bload/bsave,
is
it that there is insufficient user interest, etc.?
Maybe there is a better way to do what I'm trying to do.
Basically I need to perform revert() operations on the Rete instance
from
time to time. To accomplish this I have been cloning the Rete instance
before performing operations that end in a revert.
Thanks,
Willie
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
---------------------------------------------------------------------
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]
---------------------------------------------------------------------