From: Miguel <mig...@us...> - 2004-06-03 17:51:54
|
Update of /cvsroot/jmol/Jmol/src/org/openscience/jmol/viewer/datamodel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27706/src/org/openscience/jmol/viewer/datamodel Modified Files: Atom.java Log Message: a little work on converting stars to primes Index: Atom.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/openscience/jmol/viewer/datamodel/Atom.java,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- Atom.java 1 Jun 2004 13:53:07 -0000 1.72 +++ Atom.java 3 Jun 2004 17:51:27 -0000 1.73 @@ -525,11 +525,29 @@ static { for (int i = JmolConstants.specialAtomNames.length; --i >= 0; ) { String specialAtomName = JmolConstants.specialAtomNames[i]; - if (specialAtomName != null) - htAtom.put(JmolConstants.specialAtomNames[i], new Integer(i)); + if (specialAtomName != null) { + htAtom.put(specialAtomName, new Integer(i)); + String alternateAtomName = generateStarredAtomName(specialAtomName); + if (alternateAtomName != null) + htAtom.put(specialAtomName, new Integer(i)); + } } } + static String generateStarredAtomName(String primedAtomName) { + int primeIndex = primedAtomName.indexOf('\''); + if (primeIndex < 0) + return null; + return primedAtomName.replace('\'', '*'); + } + + static String generatePrimeAtomName(String starredAtomName) { + int starIndex = starredAtomName.indexOf('*'); + if (starIndex < 0) + return null; + return starredAtomName.replace('*', '\''); + } + byte lookupSpecialAtomID(String atomName) { if (atomName != null) { Integer boxedAtomID = (Integer)htAtom.get(atomName); |