Hello.

Here's my new version of my KeyHelper which supports prefixed ComboKeys, as
I explained previously.  It works quite nicely.

Hope this may be helpful to other people with similar problems...

PS: For archival purposes, should I rather include the code directly into
the body of my emails?

-- Mathieu

-----Original Message-----
From: Mathieu Frenette [mailto:[EMAIL PROTECTED]]
Sent: March 28, 2002 4:28 PM
To: 'Turbine Developers List'
Subject: RE: Infinite loop in ComboKey(String) constructor


Hello again!

During my inspection of ComboKey I realized it was a work in progress.  The
ComboKey(String) constructor is not functional, because it calls
setValue(String) which doesn't work with an uninitialized ComboKey object
(which is always uninitialized during the construction phase).

I saw that some code was commented out and replaced by a throw statement.
The so commented code assumes the existence of a SimpleyKey(String)
constructor (which obviously doesn't exists, because SimpleyKey is
abstract).  I guess the code was abandonned in this way because there is no
reasonable way to figure out the type of key to instanciate from a String
(no factory could possibly do that because of the simple format of the key
string).

What I will be doing in my code is always encode ComboKeys in my own format,
with a prefix for each key that make up the combo, and I'll create a factory
to parse that back into an array of SimpleKeys, which I will then pass to
the ComboKey(SimpleKey[]) constructor.

I already have such a mecanism for prefixing keys, so it should not be a
problem to extend it to ComboKeys.

I thought I could contribute with my code, but unfortunately this solution
involves a different string format, which takes us too far from what Torque
uses right now.

If you want to have a peek at my code, I'm attaching my KeyHelper which acts
as a key factory/string formatter.  In short, my NumberKeys look like
"n123", StringKeys like "sHello", and ComboKeys like "c123:456".  But what I
will be doing is format ComboKeys like this "cn123:n456".

I consider this to be one of the only ways to make ComboKeys really usable
as strings.  Does anyone think this solution is viable?

Any comments on that?  I haven't searched the archives, so maybe it has
already been discussed widely...  Sorry if this is the case.

Regards,

-- Mathieu

Attachment: KeyHelper.java
Description: JavaScript source

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to