[Jmol-commits] SF.net SVN: jmol: [4681] trunk/Jmol/src/org/jmol/viewer/Eval.java
Revision: 4681 Author: hansonr Date: 2006-03-22 04:29:28 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4681&view=rev Log Message: --- Eval: just adding some error traps; some may be unnecessary. Modified Paths: -- trunk/Jmol/src/org/jmol/viewer/Eval.java Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java === --- trunk/Jmol/src/org/jmol/viewer/Eval.java2006-03-22 02:43:59 UTC (rev 4680) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java2006-03-22 12:29:28 UTC (rev 4681) @@ -738,6 +738,10 @@ evalError("variable undefined:" + varName); } + void endOfStatementUnexpected() throws ScriptException { +evalError("unexpected end of script command"); + } + void badArgumentCount() throws ScriptException { evalError("bad argument count"); } @@ -1769,6 +1773,8 @@ Hashtable variables = new Hashtable(); void define() throws ScriptException { +if (statementLength == 1) + keywordExpected(); String variable = (String) statement[1].value; variables.put(variable, (expression(statement, 2))); } @@ -1813,6 +1819,8 @@ int i = 1; // ignore optional file format String filename = "fileset"; +if (statementLength == 1) + filenameExpected(); if (statement[i].tok == Token.identifier) ++i; if (statement[i].tok != Token.string) @@ -2148,6 +2156,8 @@ } void script() throws ScriptException { +if (statementLength == 1) + endOfStatementUnexpected(); if (statement[1].tok != Token.string) filenameExpected(); pushContext(); @@ -2173,6 +2183,8 @@ } void translate() throws ScriptException { +if (statementLength <3) + endOfStatementUnexpected(); if (statement[2].tok != Token.integer) integerExpected(); int percent = statement[2].intValue; @@ -2198,6 +2210,8 @@ } void zoom() throws ScriptException { +if (statementLength == 1) + endOfStatementUnexpected(); if (statement[1].tok == Token.integer) { int percent = statement[1].intValue; if (percent < 5 || percent > Viewer.MAXIMUM_ZOOM_PERCENTAGE) @@ -2220,6 +2234,8 @@ void delay() throws ScriptException { long timeBegin = System.currentTimeMillis(); long millis = 0; +if (statementLength == 1) + endOfStatementUnexpected(); Token token = statement[1]; switch (token.tok) { case Token.integer: @@ -2315,6 +2331,8 @@ } void slab() throws ScriptException { +if (statementLength == 1) + endOfStatementUnexpected(); if (statement[1].tok == Token.integer) { int percent = statement[1].intValue; if (percent < 0 || percent > 100) @@ -2612,6 +2630,8 @@ } void dots() throws ScriptException { +if (statementLength == 1) + endOfStatementUnexpected(); short mad = 0; switch (statement[1].tok) { case Token.on: @@ -2638,6 +2658,9 @@ void proteinShape(int shapeType) throws ScriptException { short mad = 0; +if (statementLength == 1) + endOfStatementUnexpected(); + int tok = statement[1].tok; switch (tok) { case Token.on: @@ -2883,6 +2906,8 @@ */ void set() throws ScriptException { +if (statementLength == 1) + endOfStatementUnexpected(); switch (statement[1].tok) { case Token.axes: setAxes(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 ___ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits
[Jmol-commits] SF.net SVN: jmol: [4682] trunk/Jmol-datafiles
Revision: 4682 Author: migueljmol Date: 2006-03-22 08:52:15 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4682&view=rev Log Message: --- sample data file and resolver work for MDL v3000 format Modified Paths: -- trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java Added Paths: --- trunk/Jmol-datafiles/v3000/ trunk/Jmol-datafiles/v3000/WO0119816T.sdf Modified: trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java === --- trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java 2006-03-22 12:29:28 UTC (rev 4681) +++ trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java 2006-03-22 16:52:15 UTC (rev 4682) @@ -103,6 +103,8 @@ LimitedLineReader llr = new LimitedLineReader(bufferedReader, 16384); for (int i = 0; i < lines.length; ++i) lines[i] = llr.readLineWithNewline(); +if (checkV3000(lines)) + return "V3000"; if (checkMol(lines)) return "Mol"; if (checkXyz(lines)) @@ -142,12 +144,20 @@ // file types that need special treatment + static boolean checkV3000(String[] lines) { +if (lines[3].length() >= 6) { + String line4trimmed = lines[3].trim(); + if (line4trimmed.endsWith("V3000")) +return true; +} +return false; + } + static boolean checkMol(String[] lines) { if (lines[3].length() >= 6) { String line4trimmed = lines[3].trim(); if (line4trimmed.endsWith("V2000") || - line4trimmed.endsWith("v2000") || - line4trimmed.endsWith("V3000")) + line4trimmed.endsWith("v2000")) return true; try { Integer.parseInt(lines[3].substring(0, 3).trim()); Added: trunk/Jmol-datafiles/v3000/WO0119816T.sdf === --- trunk/Jmol-datafiles/v3000/WO0119816T.sdf (rev 0) +++ trunk/Jmol-datafiles/v3000/WO0119816T.sdf 2006-03-22 16:52:15 UTC (rev 4682) @@ -0,0 +1,368 @@ + + 02260622002D 0 0.0 0.0 0 +HDR: RoxyName (Build 030), Copyright (c) 2001-2005. All rights reserved. + 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 7 6 0 0 0 +M V30 BEGIN ATOM +M V30 1 S 0.75 2.25 0 0 +M V30 2 C 2.04904 3 0 0 +M V30 3 C 3.34808 2.25 0 0 CFG=2 +M V30 4 N 3.34808 0.75 0 0 +M V30 5 C 4.64711 3 0 0 +M V30 6 O 5.94615 2.25 0 0 +M V30 7 O 4.64711 4.5 0 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 1 1 2 +M V30 2 1 2 3 +M V30 3 1 3 4 CFG=1 +M V30 4 1 3 5 +M V30 5 2 5 6 +M V30 6 1 5 7 +M V30 END BOND +M V30 BEGIN COLLECTION +M V30 MDLV30/STEABS ATOMS=(1 3) +M V30 END COLLECTION +M V30 END CTAB +M END +> +CYSTEINE + + + + 02260622002D 0 0.0 0.0 0 +HDR: RoxyName (Build 030), Copyright (c) 2001-2005. All rights reserved. + 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 11 11 0 0 0 +M V30 BEGIN ATOM +M V30 1 N 3.75 0.750001 0 0 +M V30 2 C 3 2.04904 0 0 CFG=2 +M V30 3 C 1.5 2.04904 0 0 +M V30 4 O 0.750001 0.75 0 0 +M V30 5 O 0.75 3.34808 0 0 +M V30 6 C 3.75 3.34808 0 0 +M V30 7 C 5.25 3.34808 0 0 +M V30 8 C 6.13168 4.5616 0 0 +M V30 9 N 7.55826 4.09808 0 0 +M V30 10 C 7.55827 2.59808 0 0 +M V30 11 N 6.13168 2.13455 0 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 1 2 1 CFG=3 +M V30 2 1 2 3 +M V30 3 1 2 6 +M V30 4 2 3 4 +M V30 5 1 3 5 +M V30 6 1 6 7 +M V30 7 2 7 8 +M V30 8 1 7 11 +M V30 9 1 8 9 +M V30 10 1 9 10 +M V30 11 2 10 11 +M V30 END BOND +M V30 BEGIN COLLECTION +M V30 MDLV30/STEABS ATOMS=(1 2) +M V30 END COLLECTION +M V30 END CTAB +M END +> +histidine + + + + + 02260622012D 0 0.0 0.0 0 +HDR: RoxyName (Build 030), Copyright (c) 2001-2005. All rights reserved. + 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 12 12 0 0 0 +M V30 BEGIN ATOM +M V30 1 N 4.64711 3.75 0 0 +M V30 2 C 3.34808 3 0 0 CFG=2 +M V30 3 C 2.04904 3.75 0 0 +M V30 4 O 0.75 3 0 0 +M V30 5 O 2.04904 5.25 0 0 +M V30 6 C 3.34808 1.5 0 0 +M V30 7 C 5.94615 3 0 0 CFG=3 +M V30 8 C 7.24519 3.75 0 0 +M V30 9 C 8.54423 3 0 0 +M V30 10 C 8.54423 1.5 0 0 +M V30 11 C 7.2452 0.75 0 0 +M V30 12 C 5.94616 1.5 0 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 1 1 2 +M V30 2 1 1 7 +M V30 3 1 2 3 +M V30 4 1 2 6 CFG=1 +M V30 5 2 3 4 +M V30 6 1 3 5 +M V30 7 1 7 8 +M V30 8 1 7 12 +M V30 9 1 8 9 +M V30 10 1 9 10 +M V30 11 1 10 11 +M V30 12 1 11 12 +M V30 END BOND +M V30 BEGIN COLLECTION +M V30 MDLV30/STEABS ATOMS=(1 2) +M V30 END COLLECTION +M V30 END CTAB +M END +> +cyclohexyl alanine + + + + 02260622032D 0 0.0 0.0 0 +HDR: RoxyName (Build 030), Copyright (c) 2001-2005. All rights reserved. + 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 25 27 0 0 0 +M V30 BEGIN
[Jmol-commits] SF.net SVN: jmol: [4683] trunk/Jmol/src/org/jmol/adapter/smarter/V3000Reader.java
Revision: 4683 Author: migueljmol Date: 2006-03-22 10:33:25 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4683&view=rev Log Message: --- simple version of V3000 reader that only reads atoms Added Paths: --- trunk/Jmol/src/org/jmol/adapter/smarter/V3000Reader.java Added: trunk/Jmol/src/org/jmol/adapter/smarter/V3000Reader.java === --- trunk/Jmol/src/org/jmol/adapter/smarter/V3000Reader.java (rev 0) +++ trunk/Jmol/src/org/jmol/adapter/smarter/V3000Reader.java2006-03-22 18:33:25 UTC (rev 4683) @@ -0,0 +1,122 @@ +/* $RCSfile$ + * $Author: hansonr $ + * $Date: 2006-03-15 08:52:29 -0500 (Wed, 15 Mar 2006) $ + * $Revision: 4614 $ + * + * Copyright (C) 2006 Miguel, Jmol Development, www.jmol.org + * + * Contact: [EMAIL PROTECTED] + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.jmol.adapter.smarter; + +import org.jmol.api.JmolAdapter; + +import java.io.BufferedReader; + +/** + * A reader for MDL V3000 files + * + * + * http://www.mdli.com/downloads/public/ctfile/ctfile.jsp + * + * + */ +class V3000Reader extends AtomSetCollectionReader { + + int headerAtomCount; + int headerBondCount; + + AtomSetCollection readAtomSetCollection(BufferedReader reader) +throws Exception { +atomSetCollection = new AtomSetCollection("v3000"); +processCtab(reader); +return atomSetCollection; + } + + void processCtab(BufferedReader reader) throws Exception { +String line; +do { + line = reader.readLine(); + if (line == null) +return; +} while (! line.startsWith("M V30 BEGIN CTAB")); +line = reader.readLine(); +while (line != null && ! line.startsWith("M END")) { + if (line.startsWith("M V30 COUNTS")) { +processCounts(line); +line = reader.readLine(); +continue; + } + if (line.startsWith("M V30 BEGIN ATOM")) { +line = processAtomBlock(reader); +continue; + } + /* + if (line.startsWith("M V30 BEGIN BOND")) { +line = processBond(reader); +continue; + } + */ + line = reader.readLine(); +} + } + + void processCounts(String line) { +headerAtomCount = parseInt(line, 13); +headerBondCount = parseInt(line, ichNextParse); + } + + String processAtomBlock(BufferedReader reader) throws Exception { +for (int i = headerAtomCount; --i >= 0; ) { + String line = readLineWithContinuation(reader); + if (line == null || (! line.startsWith("M V30 "))) +throw new Exception("unrecognized atom"); + Atom atom = atomSetCollection.addNewAtom(); + atom.atomSerial = parseInt(line, 7); + atom.elementSymbol = parseToken(line, ichNextParse); + atom.x = parseFloat(line, ichNextParse); + atom.y = parseFloat(line, ichNextParse); + atom.z = parseFloat(line, ichNextParse); + parseInt(line, ichNextParse); // discard aamap + while (true) { +String option = parseToken(line, ichNextParse); +if (option == null) + break; +if (option.startsWith("CHG=")) + atom.formalCharge = parseInt(option, 4); + } +} +String line = reader.readLine(); +if (line == null || ! line.startsWith("M V30 END ATOM")) + throw new Exception("M V30 END ATOM not found"); +return line; + } + + String readLineWithContinuation(BufferedReader reader) throws Exception { +String line = reader.readLine(); +if (line != null && line.length() > 7) { + while (line.charAt(line.length() - 1) == '-') { +String line2 = reader.readLine(); +if (line2 == null || ! line.startsWith("M V30 ")) + throw new Exception("Invalid line continuation"); +line += line2.substring(7); + } +} +return line; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into th
[Jmol-commits] SF.net SVN: jmol: [4684] trunk/Jmol/src/org/jmol/adapter/smarter
Revision: 4684 Author: migueljmol Date: 2006-03-22 19:18:30 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4684&view=rev Log Message: --- more work on V3000 reader ... but must be integrated with MolReader because an .sdf file can contain a mixture of V3000 and V2000 stuff :-( Modified Paths: -- trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java trunk/Jmol/src/org/jmol/adapter/smarter/V3000Reader.java Modified: trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java === --- trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2006-03-22 18:33:25 UTC (rev 4683) +++ trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2006-03-23 03:18:30 UTC (rev 4684) @@ -148,7 +148,7 @@ for (int i = atomCount; --i >= 0; ) atoms[i] = null; atomCount = 0; -atomNameMap.clear(); +atomSymbolicMap.clear(); atomSetCount = 0; currentAtomSetIndex = -1; for (int i = atomSetNumbers.length; --i >= 0; ) { @@ -231,6 +231,11 @@ mapMostRecentAtomName(); } + void addAtomWithMappedSerialNumber(Atom atom) { +addAtom(atom); +mapMostRecentAtomSerialNumber(); + } + Bond addNewBond(int atomIndex1, int atomIndex2) { return addNewBond(atomIndex1, atomIndex2, 1); } @@ -240,6 +245,9 @@ } Bond addNewBond(int atomIndex1, int atomIndex2, int order) { +if (atomIndex1 < 0 || atomIndex1 >= atomCount || +atomIndex2 < 0 || atomIndex2 >= atomCount) + return null; Bond bond = new Bond(atomIndex1, atomIndex2, order); addBond(bond); return bond; @@ -251,6 +259,13 @@ order); } + Bond addNewBondWithMappedSerialNumbers(int atomSerial1, int atomSerial2, + int order) { +return addNewBond(getAtomSerialNumberIndex(atomSerial1), + getAtomSerialNumberIndex(atomSerial2), + order); + } + void addBond(Bond bond) { /* System.out.println("I see a bond:" + bond.atomIndex1 + "-" + @@ -285,28 +300,45 @@ } } - Hashtable atomNameMap = new Hashtable(); + Hashtable atomSymbolicMap = new Hashtable(); void mapMostRecentAtomName() { if (atomCount > 0) { int index = atomCount - 1; String atomName = atoms[index].atomName; if (atomName != null) -atomNameMap.put(atomName, new Integer(atomCount - 1)); +atomSymbolicMap.put(atomName, new Integer(index)); } } + void mapMostRecentAtomSerialNumber() { +if (atomCount > 0) { + int index = atomCount - 1; + int atomSerial = atoms[index].atomSerial; + if (atomSerial != Integer.MIN_VALUE) +atomSymbolicMap.put(new Integer(atomSerial), new Integer(index)); +} + } + void mapAtomName(String atomName, int atomIndex) { -atomNameMap.put(atomName, new Integer(atomIndex)); +atomSymbolicMap.put(atomName, new Integer(atomIndex)); } - + int getAtomNameIndex(String atomName) { int index = -1; -Object value = atomNameMap.get(atomName); +Object value = atomSymbolicMap.get(atomName); if (value != null) index = ((Integer)value).intValue(); return index; } + + int getAtomSerialNumberIndex(int serialNumber) { +int index = -1; +Object value = atomSymbolicMap.get(new Integer(serialNumber)); +if (value != null) + index = ((Integer)value).intValue(); +return index; + } /** * Sets a property for the AtomSetCollection @@ -334,7 +366,6 @@ void newAtomSet() { -//System.out.println("newAtomSet()"); currentAtomSetIndex = atomSetCount++; if (atomSetCount > atomSetNumbers.length) { atomSetNumbers = AtomSetCollectionReader.doubleLength(atomSetNumbers); @@ -347,6 +378,11 @@ (Hashtable[]) AtomSetCollectionReader.doubleLength(atomSetAuxiliaryInfo); } atomSetNumbers[currentAtomSetIndex] = atomSetCount; +// miguel 2006 03 22 +// added this clearing of the atomSymbolicMap to support V3000 +// seems that it should have been here all along, but apparently +// noone else needed it +atomSymbolicMap.clear(); } /** Modified: trunk/Jmol/src/org/jmol/adapter/smarter/V3000Reader.java === --- trunk/Jmol/src/org/jmol/adapter/smarter/V3000Reader.java2006-03-22 18:33:25 UTC (rev 4683) +++ trunk/Jmol/src/org/jmol/adapter/smarter/V3000Reader.java2006-03-23 03:18:30 UTC (rev 4684) @@ -44,36 +44,43 @@ AtomSetCollection readAtomSetCollection(BufferedReader reader) throws Exception { atomSetCollection = new AtomSetCollection("v3000"); -processCtab(reader); +boolean startNewAtomSet = false; +String line; +while (true) { + line = processCtab(reader, startNewAtomSet)
[Jmol-commits] SF.net SVN: jmol: [4685] trunk/Jmol/src/org/jmol/viewer
Revision: 4685 Author: hansonr Date: 2006-03-22 20:18:56 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4685&view=rev Log Message: --- Eval: cleaning up code; moving to appropriate locations and accessing via Viewer. Philosophy: 1. If all of the method calls in a method are methods in frame, this method should be in frame. 2. Eval should not be doing model selection/bitset creation functions that are not unique to scripts. 3. Moving these methods opens up more possibilities for applet-applet communication via more direct methods than script. Modified Paths: -- trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Frame.java trunk/Jmol/src/org/jmol/viewer/ModelManager.java trunk/Jmol/src/org/jmol/viewer/SelectionManager.java trunk/Jmol/src/org/jmol/viewer/TransformManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java === --- trunk/Jmol/src/org/jmol/viewer/Eval.java2006-03-23 03:18:30 UTC (rev 4684) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java2006-03-23 04:18:56 UTC (rev 4685) @@ -30,8 +30,6 @@ import java.util.BitSet; import java.util.Vector; import java.util.Hashtable; -import javax.vecmath.AxisAngle4f; -import javax.vecmath.Matrix3f; import javax.vecmath.Point3f; import javax.vecmath.Vector3f; @@ -942,15 +940,6 @@ return bs; } - int firstAtomOf(BitSet bs) { -int numberOfAtoms = viewer.getAtomCount(); -for (int i = numberOfAtoms; --i >= 0;) - if (bs.get(i)) { -return i; - } -return -1; - } - int endOfExpression; BitSet expression(Token[] code, int pcStart) throws ScriptException { @@ -1014,55 +1003,41 @@ stack[sp++] = copyBitSet(viewer.getVisibleSet()); break; case Token.hetero: -stack[sp++] = getHeteroSet(); -break; case Token.hydrogen: -stack[sp++] = getHydrogenSet(); + case Token.protein: + case Token.nucleic: + case Token.dna: + case Token.rna: + case Token.purine: + case Token.pyrimidine: +stack[sp++] = viewer.getAtomBits((String) instruction.value); break; case Token.spec_name_pattern: -stack[sp++] = getSpecName((String) instruction.value); +stack[sp++] = viewer.getAtomBits("SpecName", (String) instruction.value); break; case Token.spec_resid: -stack[sp++] = getSpecResid(instruction.intValue); +stack[sp++] = viewer.getAtomBits("SpecResid", instruction.intValue); break; case Token.spec_seqcode: -stack[sp++] = getSpecSeqcode(instruction.intValue); +stack[sp++] = viewer.getAtomBits("SpecSeqcode",instruction.intValue); break; case Token.spec_seqcode_range: int seqcodeA = instruction.intValue; int seqcodeB = ((Integer) instruction.value).intValue(); -stack[sp++] = getSpecSeqcodeRange(seqcodeA, seqcodeB); +stack[sp++] = viewer.getAtomBits("SpecSeqcodeRange", seqcodeA, seqcodeB); break; case Token.spec_chain: -stack[sp++] = getSpecChain((char) instruction.intValue); +stack[sp++] = viewer.getAtomBits("SpecChain", instruction.intValue); break; case Token.spec_atom: -stack[sp++] = getSpecAtom((String) instruction.value); +stack[sp++] = viewer.getAtomBits("SpecAtom", (String) instruction.value); break; case Token.spec_alternate: -stack[sp++] = getSpecAlternate((String) instruction.value); +stack[sp++] = viewer.getAtomBits("SpecAlternate", (String) instruction.value); break; case Token.spec_model: -stack[sp++] = getSpecModel((String) instruction.value); +stack[sp++] = viewer.getAtomBits("SpecModel", (String) instruction.value); break; - case Token.protein: -stack[sp++] = getProteinSet(); -break; - case Token.nucleic: -stack[sp++] = getNucleicSet(); -break; - case Token.dna: -stack[sp++] = getDnaSet(); -break; - case Token.rna: -stack[sp++] = getRnaSet(); -break; - case Token.purine: -stack[sp++] = getPurineSet(); -break; - case Token.pyrimidine: -stack[sp++] = getPyrimidineSet(); -break; case Token.y: case Token.amino: case Token.backbone: @@ -1070,7 +1045,7 @@ case Token.identifier: case Token.sidechain: case Token.surface: -stack[sp++] = lookupIdentifierValue((String) instruction.value); +stack[sp++] = viewer.getAtomBits("IdentifierValue", (String) instruction.value); break; case Token.opLT: case Token.opLE: @@ -1090,6 +1065,15 @@ return stack[0]; } + void notSet(BitSet bs) { +for (int i = viewer.getAtomCount(); --i >= 0;) { +
[Jmol-commits] SF.net SVN: jmol: [4686] trunk/Jmol/src/org/jmol/viewer/Eval.java
Revision: 4686 Author: hansonr Date: 2006-03-22 21:16:53 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4686&view=rev Log Message: --- removing unnecessary statementLength checks; leaves necessary ones in -- load and translate, for example. Modified Paths: -- trunk/Jmol/src/org/jmol/viewer/Eval.java Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java === --- trunk/Jmol/src/org/jmol/viewer/Eval.java2006-03-23 04:18:56 UTC (rev 4685) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java2006-03-23 05:16:53 UTC (rev 4686) @@ -1927,8 +1927,7 @@ } void script() throws ScriptException { -if (statementLength == 1) - endOfStatementUnexpected(); +// token allows for only 1 parameter if (statement[1].tok != Token.string) filenameExpected(); pushContext(); @@ -1946,7 +1945,7 @@ void translate() throws ScriptException { if (statementLength <3) - endOfStatementUnexpected(); + badArgumentCount(); if (statement[2].tok != Token.integer) integerExpected(); int percent = statement[2].intValue; @@ -1972,8 +1971,7 @@ } void zoom() throws ScriptException { -if (statementLength == 1) - endOfStatementUnexpected(); +// token has ondefault1 if (statement[1].tok == Token.integer) { int percent = statement[1].intValue; if (percent < 5 || percent > Viewer.MAXIMUM_ZOOM_PERCENTAGE) @@ -1996,8 +1994,7 @@ void delay() throws ScriptException { long timeBegin = System.currentTimeMillis(); long millis = 0; -if (statementLength == 1) - endOfStatementUnexpected(); +//token has ondefault1 Token token = statement[1]; switch (token.tok) { case Token.integer: @@ -2041,8 +2038,7 @@ } void slab() throws ScriptException { -if (statementLength == 1) - endOfStatementUnexpected(); +//token has ondefault1 if (statement[1].tok == Token.integer) { int percent = statement[1].intValue; if (percent < 0 || percent > 100) @@ -2340,8 +2336,7 @@ } void dots() throws ScriptException { -if (statementLength == 1) - endOfStatementUnexpected(); +// token has onDefault1 short mad = 0; switch (statement[1].tok) { case Token.on: @@ -2368,9 +2363,7 @@ void proteinShape(int shapeType) throws ScriptException { short mad = 0; -if (statementLength == 1) - endOfStatementUnexpected(); - +//token has ondefault1 int tok = statement[1].tok; switch (tok) { case Token.on: @@ -2616,8 +2609,6 @@ */ void set() throws ScriptException { -if (statementLength == 1) - endOfStatementUnexpected(); switch (statement[1].tok) { case Token.axes: setAxes(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 ___ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits
[Jmol-commits] SF.net SVN: jmol: [4687] trunk/Jmol/src/org/jmol/viewer/Eval.java
Revision: 4687 Author: hansonr Date: 2006-03-22 21:31:26 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4687&view=rev Log Message: --- Eval quick fix. Modified Paths: -- trunk/Jmol/src/org/jmol/viewer/Eval.java Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java === --- trunk/Jmol/src/org/jmol/viewer/Eval.java2006-03-23 05:16:53 UTC (rev 4686) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java2006-03-23 05:31:26 UTC (rev 4687) @@ -1045,7 +1045,7 @@ case Token.identifier: case Token.sidechain: case Token.surface: -stack[sp++] = viewer.getAtomBits("IdentifierValue", (String) instruction.value); +stack[sp++] = lookupIdentifierValue((String) instruction.value); break; case Token.opLT: case Token.opLE: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 ___ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits