>>  * renamed 'strings' -> 'tokens' in the atomArray handling
>
> Fine, I just copied the name you used :)

I realize that :-)

In CML1 the tag was called 'string' ... so I thought that the array name
'strings' was appropriate.

In CML2, since the tag is no longer called 'string', I thought it should
be changed.

>>  * changed the implementation so that the Atom[] atoms and the String[]
>> tokens are reused ... rather than reallocated repeatedly.
>
> Yes, I saw that you were using that... but I was not sure how to do
> that when the array growed in size... actually... how does that work?

The atom values themselves don't get reused. But the array which holds
them can be reused.

> Yes, I'm not very good in writing performace efficient code ...
> I really have no idea about the costs of certain types of
> operations... and therefore generally focus on easy to understand
> code... (at least for me :)...

In general, your approach is the right one ... do what works for you.

One warning flag is a 'new' operation which happens in a loop. The expense
is in the reclamation (garbage collecting) more than the allocation.

In this case it wasn't a big deal ... but I changed it on principle.

>>  * reduced the code size by combining a few calls
>
> Yes, saw that... looks fine.

In each clause of the branch you were executing 3 or 4 lines which were
very similar, caluclating strings and comparing strings.length with
atomArray.length. If you find yourself repeating something 3 or 4 times
then think about pushing it down a level. The most important thing is that
it makes the code smaller, easier to understand, and easier to extend when
you have to add additional branches.

>> Q: If you have an atomArray with the various attributes as multi-token
>> strings, should it be an error if all of the strings are not the same
>> length?
>
> Not sure... but I think so.

I think so too.

The current code is resizing the atomArray if (tokenCount > atomCount)

I think this is a mistake ... it should say something like
  if (atomCount == 0)
    allocate-the-atoms(tokenCount);
  else if (tokenCount != atomCount)
    throw-an-exception


Miguel



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Jmol-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to