Hi Bob,

I am not sure that we need to specify explicit values for ids for Enum (even if we need ids outside the enum).

There are many things that can be done properly with Enums.
For example, the ordinal() method should return an automatic numeric identifier for each instance (it starts at 0 for the first and increments by one for each)

I will try to find time to look at the current code to see what can be done.
What are the enums where you are not really satisfied ?

Nico

On Sat, Aug 6, 2011 at 5:20 PM, Robert Hanson <hansonr@stolaf.edu> wrote:
I took a whack at this and found one bug even. Hopefully introduced no more. But it does feel right. There are some instances, such  as with the axesMode and with proteinStructure where we need to have an integer ID still and refer to that because that is documented as being exposed.

Very interesting that if you do this:

enum EnumTest {

  TEST(1);

  public int id;

  EnumTest(int id) { 
    this.id = id;
  }
}

Then even though TEST is a final static reference and can be used in static classes, TEST.id is not and cannot, for example, be used in switch() statements. I guess that's because the instantiation of an EnumTest is not static, only its hidden reference identifier is. So that complicated things -- there are a few cases where we need to have faster access to the class -- for example in coloring atoms -- and for that I also kept the constants. That's not totally satisfying, but we would have to reserve a reference to an Enum instead of a byte for every single atom if we did it more cleanly, and I just don't want to do that. Or I'm missing  something. I did opt for structure references to EnumStructure, and that worked very nicely. Still have an ID there to distinguish proteins.

Bob





--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers