From: <a.s...@ch...> - 2007-09-10 21:33:30
|
Sounds good to me. I personally use enums quite frequently and they are very handy. Another advantage is that enums implement the Comparable interface. Their "natural order" is the order in which they are defined in the enum class. And using EnumSets one can iterate over all elements of an enumeration. Cheers, Andreas Egon Willighagen wrote: > Hi all, > > one of the joys of Java5 is the concept of enumerations. I have used > that already in the JChemPaint editor code in trunk/ for edit modes. > It is particularly suited for situations where a well defined list of > concepts is enumerated. Think: elements, bond types, hybridization > states, ... > > Converting IBond.getOrder() into an enumeration has these advantages: > > - exactly three options: SINGLE, DOUBLE, TRIPLE (well, maybe QUADRUPLE > and BRIDGED too?), being final static > - just 3 (maybe 5) object instances, instead of a million Double objects > > Or. proper == stuff: no problems with 1.00001 bond orders; and a big > expected memory improvement. > > Shall I implement this? > > Egon > -- Andreas Schüller PhD student in the research group of Prof. Dr. Gisbert Schneider Johann Wolfgang Goethe University Beilstein-endowed Chair for Chemoinformatics Building B - 3rd floor Siesmayerstr. 70 60323 Frankfurt am Main Germany Tel.: +49 69 798 24879 Fax: +49 69 798 24880 http://www.modlab.de/ |