From 64e886ed16cc8b7899349231bdf1b9de81e70695 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Fri, 16 Dec 2011 05:15:39 -0500 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- README | 30 +++---- alltests.js | 8 +- index.html | 16 ++-- jchemhub/controller/atom_controller.js | 20 ++--- jchemhub/controller/bond_controller.js | 2 +- jchemhub/controller/defaulttoolbar.js | 48 +++++----- jchemhub/controller/molecule_controller.js | 20 ++--- jchemhub/controller/plugin.js | 30 +++---- jchemhub/controller/plugin_test.html | 2 +- jchemhub/controller/plugins/clear_editor.js | 4 +- jchemhub/controller/plugins/highlight.js | 4 +- .../controller/plugins/selector_rectangle.js | 4 +- jchemhub/controller/plugins/undoredo.js | 28 +++--- jchemhub/controller/plugins/zoom.js | 4 +- jchemhub/controller/reaction_controller.js | 20 ++--- jchemhub/controller/reaction_editor.js | 70 +++++++-------- jchemhub/controller/reaction_editor_demo.html | 22 ++--- jchemhub/controller/toolbarfactory.js | 34 +++---- jchemhub/io/json.js | 38 ++++---- jchemhub/json/template_demo.html | 8 +- jchemhub/math/affine_transform.js | 6 +- jchemhub/math/line.js | 14 +-- jchemhub/math/line_test.html | 6 +- jchemhub/model/bond.js | 8 +- jchemhub/model/double_bond.js | 2 +- jchemhub/model/molecule.js | 36 ++++---- jchemhub/model/pseudo_atom.js | 8 +- jchemhub/model/single_bond.js | 2 +- jchemhub/model/single_bond_up.js | 2 +- jchemhub/model/single_bond_up_or_down.js | 2 +- jchemhub/model/triple_bond.js | 2 +- jchemhub/qsmiles/smi2mol.html | 4 +- jchemhub/qsmiles/smiles.js | 12 +-- jchemhub/qsmiles/smiles_time.html | 2 +- jchemhub/ring/ring_finder.js | 44 +++++----- jchemhub/ring/ring_finder_test.html | 18 ++-- jchemhub/smiles/smilesParser.js | 88 +++++++++---------- jchemhub/smiles/smiles_parser_test.html | 18 ++-- jchemhub/util/bond_util.js | 14 +-- jchemhub/view/arrow_renderer.js | 10 +-- jchemhub/view/arrow_renderer_demo.html | 4 +- jchemhub/view/atom_renderer.js | 22 ++--- jchemhub/view/atom_renderer_demo.html | 20 ++--- jchemhub/view/bond_renderer.js | 8 +- jchemhub/view/bond_renderer_demo.html | 30 +++---- jchemhub/view/bond_renderer_factory.js | 2 +- jchemhub/view/double_bond_renderer.js | 4 +- jchemhub/view/mol_demo.html | 2 +- jchemhub/view/molecule_drawing.js | 8 +- jchemhub/view/molecule_renderer.js | 2 +- jchemhub/view/molecule_renderer_demo.html | 30 +++---- jchemhub/view/plus_renderer.js | 6 +- jchemhub/view/plus_renderer_demo.html | 4 +- jchemhub/view/quadruple_bond_renderer.js | 4 +- jchemhub/view/reaction_renderer.js | 22 ++--- jchemhub/view/reaction_renderer_demo.html | 8 +- jchemhub/view/renderer.js | 2 +- jchemhub/view/single_bond_drawing.js | 6 +- jchemhub/view/single_bond_renderer.js | 2 +- jchemhub/view/single_down_bond_renderer.js | 2 +- jchemhub/view/single_up_bond_renderer.js | 2 +- .../view/single_up_or_down_bond_renderer.js | 2 +- jchemhub/view/triple_bond_renderer.js | 2 +- 63 files changed, 452 insertions(+), 452 deletions(-) diff --git a/README b/README index d254a21..0adbf1f 100644 --- a/README +++ b/README @@ -12,23 +12,23 @@ This will pull in the google closure library: git submodule init git submodule update - -If you make an edit that changes a goog.provide or goog.require statement, -there are two ways to update deps.js: the first (recommended) is with the ant build script or you can use + +If you make an edit that changes a goog.provide or goog.require statement, +there are two ways to update deps.js: the first (recommended) is with the ant build script or you can use the command line to invoke calcdeps.py as described below. The ant script also provides for running the closure compiler which, in addition to minimizing the code to a single file, also provides many useful checks. With ant: -You need to have ant installed (http://ant.apache.org). +You need to have ant installed (http://ant.apache.org). From the base jchemhub directory, to see the usage message, just execute ant - + Usage is the default target, so you should see output something like this: - + Buildfile: build.xml usage: @@ -44,26 +44,26 @@ Usage is the default target, so you should see output something like this: compile-whitespace-only compile with WHITESPACE_ONLY setting usage Display main targets by running 'ant -projecthelp' Default target: usage - + To update deps.js, execute the build-deps target: - + ant build-deps - -The targets compile-whitespace-only, compile-simple, compile-advanced include only files to support jchemhub.controller.ReactionEditor. + +The targets compile-whitespace-only, compile-simple, compile-advanced include only files to support jchemhub.controller.ReactionEditor. The smallest download size will result from executing: - + ant compile-advanced - + The compile output will be created in a 'build' directory that will be created if necessary. The target compile-check attempts to compile all jchemhub code. This purpose of this target is to take advantage of the closure compile-time checks that -include static type checking, access violations, etc. For more information on options (not all of which are currently enabled in the ant build script) see +include static type checking, access violations, etc. For more information on options (not all of which are currently enabled in the ant build script) see http://code.google.com/p/closure-compiler/wiki/Warnings. Alternatively, without ant, it is also possibly to execute the calcdeps python script as follows to re-generate deps.js: cd third-party/closure/closure/goog/ - - python ../bin/calcdeps.py -o deps -p ../../../../jchemhub/ -p ../../closure/ > ../../../../jchemhub/deps.js + + python ../bin/calcdeps.py -o deps -p ../../../../jchemhub/ -p ../../closure/ > ../../../../jchemhub/deps.js diff --git a/alltests.js b/alltests.js index 171dd2e..b5091a2 100644 --- a/alltests.js +++ b/alltests.js @@ -13,10 +13,10 @@ // limitations under the License. var _allTests = [ "jchemhub/smiles/smiles_parser_test.html", - "jchemhub/math/line_test.html", + "jchemhub/math/line_test.html", "/jchemhub/io/json_test.html", - "jchemhub/io/mdl_test.html", - "jchemhub/model/model_test.html", + "jchemhub/io/mdl_test.html", + "jchemhub/model/model_test.html", "jchemhub/ring/ring_finder_test.html", - "jchemhub/view/plugin_test.html", + "jchemhub/view/plugin_test.html", "jchemhub/view/reaction_editor_test.html"]; \ No newline at end of file diff --git a/index.html b/index.html index c8a1404..4af8504 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ Jchemhub Demo - @@ -38,25 +38,25 @@ @@ -54,30 +54,30 @@ @@ -17,10 +17,10 @@ goog.require('goog.dom'); @@ -18,7 +18,7 @@
-Enter SMILES and +Enter SMILES and
diff --git a/jchemhub/qsmiles/smiles.js b/jchemhub/qsmiles/smiles.js index 66ce10c..82c0592 100755 --- a/jchemhub/qsmiles/smiles.js +++ b/jchemhub/qsmiles/smiles.js @@ -181,15 +181,15 @@ jchemhub.io.smiles.parseAtom = function (item) { // periodicTable has entries for c,n,o,s,as,se if (this.periodicTable[atomProp[2]]) atom.symbol = atomProp[2]; - + if (atomProp[3] == jchemhub.io.smiles.BondStereo.CLOCKWISE) { atom.stereo = atomProp[3]; } else if (atomProp[3] == jchemhub.io.smiles.BondStereo.COUNTER_CLOCKWISE) { - atom.stereo = atomProp[3]; + atom.stereo = atomProp[3]; } else { atom.stereo = jchemhub.io.smiles.BondStereo.NONE; } - + if (atomProp[4] == 'H') { if (atomProp[5]) { atom.hcount = atomProp[5]; @@ -197,7 +197,7 @@ jchemhub.io.smiles.parseAtom = function (item) { atom.hcount = 1; } } - + if (atomProp[6] == "+") { atom.charge = 1; } else if (atomProp[6] == "-") { @@ -205,7 +205,7 @@ jchemhub.io.smiles.parseAtom = function (item) { } else { atom.charge = parseInt(atomProp[6]); } - + } else { if (this.specialAtoms[item]) { atom.symbol = item; @@ -242,7 +242,7 @@ jchemhub.io.smiles.createBond = function(type, stereo, source, target) { } } switch (atype) { - + case jchemhub.io.smiles.BondType.SINGLE_BOND: switch (stereo) { case jchemhub.io.smiles.BondStereo.CLOCKWISE: diff --git a/jchemhub/qsmiles/smiles_time.html b/jchemhub/qsmiles/smiles_time.html index a1fbe2c..0353230 100644 --- a/jchemhub/qsmiles/smiles_time.html +++ b/jchemhub/qsmiles/smiles_time.html @@ -1,4 +1,4 @@ - + multiple smiles timing test diff --git a/jchemhub/ring/ring_finder.js b/jchemhub/ring/ring_finder.js index 4b15db1..ba5e3ba 100644 --- a/jchemhub/ring/ring_finder.js +++ b/jchemhub/ring/ring_finder.js @@ -1,13 +1,13 @@ /* - * Copyright [2010] [Mark Rijnbeek] - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * Copyright [2010] [Mark Rijnbeek] + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and limitations under the License. - * + * * Ring finder classes, a JavaScript->Java conversion using * the MX Hanser ring finder classes. * For MX Java source see: @@ -56,7 +56,7 @@ jchemhub.ring.RingFinder.findRings = function(_molecule){ } //xtra: sort array according to ring size goog.array.sort(atomOnlyRings); - + var rings=new Array(); for (var i = 0, il = atomOnlyRings.length; i < il; i++) { rings.push(this.createRing(atomOnlyRings[i],molecule)); @@ -71,7 +71,7 @@ jchemhub.ring.RingFinder.findRings = function(_molecule){ * @param {Object} atoms */ jchemhub.ring.RingFinder.createRing = function(atoms,molecule){ - + var bonds = new Array(); for (var i = 0, il = atoms.length-1; i < il; i++) { bond = molecule.findBond(atoms[i],atoms[i+1]); @@ -81,8 +81,8 @@ jchemhub.ring.RingFinder.createRing = function(atoms,molecule){ } //Hanser last atom is same as first atom, remove it.. goog.array.removeAt(atoms, atoms.length - 1); - - var ring = new jchemhub.ring.Ring(atoms,bonds); + + var ring = new jchemhub.ring.Ring(atoms,bonds); return ring; } @@ -123,15 +123,15 @@ jchemhub.ring.PathGraph.prototype.remove = function(atom){ goog.array.remove(this.edges, result[i]); } } - + newEdges = this.spliceEdges(oldEdges); - + for (var i = 0,il=oldEdges.length; i < il; i++) { if (goog.array.contains(this.edges, oldEdges[i])) { goog.array.remove(this.edges, oldEdges[i]); } } - + for (var i = 0,il=newEdges.length; i < il; i++) { if (!goog.array.contains(this.edges, newEdges[i])) { this.edges.push(newEdges[i]); @@ -144,10 +144,10 @@ jchemhub.ring.PathGraph.prototype.remove = function(atom){ jchemhub.ring.PathGraph.prototype.getEdges = function(atom){ var result = new Array(); - + for (var i = 0,il=this.edges.length; i < il; i++) { edge = this.edges[i]; - + if (edge.isCycle()) { if (goog.array.contains(edge.atoms, atom)) { result.push(edge); @@ -165,7 +165,7 @@ jchemhub.ring.PathGraph.prototype.getEdges = function(atom){ jchemhub.ring.PathGraph.prototype.spliceEdges = function(_edges){ var result = new Array(); - + for (var i = 0,il=_edges.length; i < il; i++) { for (var j = i + 1; j < il; j++) { spliced = _edges[j].splice(_edges[i]); @@ -199,11 +199,11 @@ jchemhub.ring.PathEdge.prototype.splice = function(other){ for (var i = 0,il=this.atoms.length; i < il; i++) { newAtoms.push(this.atoms[i]); } - + if (this.atoms[0] == intersection) { newAtoms.reverse(); } - + if (other.atoms[0] == intersection) { for (var i = 1,il=other.atoms.length; i < il; i++) { newAtoms.push(other.atoms[i]); @@ -214,11 +214,11 @@ jchemhub.ring.PathEdge.prototype.splice = function(other){ newAtoms.push(other.atoms[i]); } } - + if (!this.isRealPath(newAtoms)) { return null; } - + return new jchemhub.ring.PathEdge(newAtoms); } diff --git a/jchemhub/ring/ring_finder_test.html b/jchemhub/ring/ring_finder_test.html index bd0de75..edf104e 100644 --- a/jchemhub/ring/ring_finder_test.html +++ b/jchemhub/ring/ring_finder_test.html @@ -22,31 +22,31 @@ debugStmt += rings[i].atoms.length + " "; //console.log(debugStmt); } - + function testBenzene(){ var benzene = "\n xxx 10310613082D \n\n 6 6 0 0 0 0 999 V2000\n 0.7145 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.7145 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.7145 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2 1 2 0 0 0 0\n 3 1 1 0 0 0 0\n 4 3 2 0 0 0 0\n 5 2 1 0 0 0 0\n 6 4 1 0 0 0 0\n 5 6 2 0 0 0 0\nM END\n"; findRings("benzene", benzene, 1); } - + function testCubane(){ var cubane = "\n xxx 02140917482D \n\n 8 12 0 0 0 0 999 V2000\n 0.0001 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.4628 0.0050 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.3623 0.0052 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.4627 -0.8200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.3623 -0.8200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 4 7 1 0 0 0 0\n 4 3 1 0 0 0 0\n 3 5 1 0 0 0 0\n 1 3 1 0 0 0 0\n 1 6 1 0 0 0 0\n 2 4 1 0 0 0 0\n 2 8 1 0 0 0 0\n 8 6 1 0 0 0 0\n 5 7 1 0 0 0 0\n 7 8 1 0 0 0 0\n 1 2 1 0 0 0 0\n 6 5 1 0 0 0 0\nM END\n"; findRings("cubane", cubane, 28); } - - + + function testTetraPhosporus(){ var tetraPhosporus = "\n xxx 03240923362D \n\n 4 6 0 0 0 0 999 V2000\n 0.4357 -0.0257 0.0000 P 0 0 0 0 0 0 0 0 0 0 0 0\n -0.5702 -0.1152 0.0000 P 0 0 0 0 0 0 0 0 0 0 0 0\n -0.0772 0.5826 0.0000 P 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0632 -0.5046 0.0000 P 0 0 0 0 0 0 0 0 0 0 0 0\n 3 1 1 0 0 0 0\n 3 2 1 0 0 0 0\n 1 2 1 0 0 0 0\n 3 4 1 0 0 0 0\n 4 2 1 0 0 0 0\n 4 1 1 0 0 0 0\nM END\n"; findRings("tetraPhosporus", tetraPhosporus, 7); } - - + + function testNaphtalene(){ var naphtalene = "\n xxx 09160622362D \n\n 10 11 0 0 0 0 999 V2000\n -1.4289 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n -1.4289 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.7145 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.7145 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2 1 2 0 0 0 0\n 3 1 1 0 0 0 0\n 4 3 2 0 0 0 0\n 5 4 1 0 0 0 0\n 6 2 1 0 0 0 0\n 6 5 2 0 0 0 0\n 8 5 1 0 0 0 0\n 8 7 2 0 0 0 0\n 9 4 1 0 0 0 0\n 10 7 1 0 0 0 0\n 10 9 2 0 0 0 0\nM END\n"; findRings("naphtalene", naphtalene, 3); } - - + + function findRings(name, mdlString, count){ var mol = jchemhub.io.mdl.readMolfile(mdlString); var rings = jchemhub.ring.RingFinder.findRings(mol); @@ -54,7 +54,7 @@ //debug(name, rings); } - + diff --git a/jchemhub/smiles/smilesParser.js b/jchemhub/smiles/smilesParser.js index 8615922..f8ad518 100644 --- a/jchemhub/smiles/smilesParser.js +++ b/jchemhub/smiles/smilesParser.js @@ -1,11 +1,11 @@ /* - * Copyright [2010] [Mark Rijnbeek] - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * Copyright [2010] [Mark Rijnbeek] + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and limitations under the License. */ @@ -24,12 +24,12 @@ goog.require('jchemhub.util.BondUtil'); goog.require('jchemhub.util.BondUtil.Orders'); -/* +/* * SMILES parsing. * For more on SMILES, see: http://www.daylight.com/dayhtml_tutorials/languages/smiles/index.html * This parser is more or less a Java->Javascript port of the CDK's SMILES parser. * See: http://cdk.git.sourceforge.net/git/gitweb.cgi?p=cdk/cdk;a=summary - * + * * @author Mark Rijnbeek (markr@ebi.ac.uk) */ @@ -45,19 +45,19 @@ jchemhub.smiles.SmilesParser = function(){ */ jchemhub.smiles.SmilesParser.parse = function(smiles){ - //Initialization before parse + //Initialization before parse var bond = new jchemhub.model.Bond; var nodeCounter = 0; - var bondOrder = null; + var bondOrder = null; var bondOrderForRingClosure = jchemhub.util.BondUtil.Orders.SINGLE; - var bondIsAromatic = false; + var bondIsAromatic = false; var bondExists = true; var thisRing = -1; var currentSymbol = null; var molecule=new jchemhub.model.Molecule; var position = 0; var rings = new Array(); // array with atoms - var ringbonds = new Array(); // array with bonds + var ringbonds = new Array(); // array with bonds var mychar = 'X'; var chars = new Array(); // char[1]; var lastNode = null; //Atom @@ -73,7 +73,7 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ { status = 1; atom = null; - // A star means a pseudo atom + // A star means a pseudo atom if (mychar == '*') { currentSymbol = "*"; atom = new jchemhub.model.PseudoAtom("*",0,0); @@ -83,20 +83,20 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ //alert(currentSymbol); if (currentSymbol != null) { if (currentSymbol.length == 1) { - if (currentSymbol.toUpperCase() != currentSymbol ) { + if (currentSymbol.toUpperCase() != currentSymbol ) { currentSymbol = currentSymbol.toUpperCase(); atom = new jchemhub.model.Atom(currentSymbol); atom.hybridization=jchemhub.model.Atom.Hybridizations.SP2; - } + } else atom = new jchemhub.model.Atom(currentSymbol); - } + } else atom = new jchemhub.model.Atom(currentSymbol); } else throw "Found element which is not a 'organic subset' element. You must use [" + mychar + "]."; } - molecule.addAtom(atom); + molecule.addAtom(atom); if ((lastNode != null) && bondExists) { bond = jchemhub.util.BondUtil.getBond (atom, lastNode,bondOrder); @@ -111,7 +111,7 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ position = position + currentSymbol.length; bondExists = true; bondIsAromatic = false; - } + } else if (mychar == '=') { //alert(mychar); @@ -120,15 +120,15 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ bondOrder = jchemhub.util.BondUtil.Orders.DOUBLE; else bondOrderForRingClosure = jchemhub.util.BondUtil.Orders.DOUBLE; - } + } else if (mychar == '#') { //alert(mychar); position++; - if (status == 2 || !((smiles.charAt(position) >= '0' && smiles.charAt(position) <= '9') || smiles.charAt(position) == '%')) + if (status == 2 || !((smiles.charAt(position) >= '0' && smiles.charAt(position) <= '9') || smiles.charAt(position) == '%')) bondOrder = jchemhub.util.BondUtil.Orders.TRIPLE; - else + else bondOrderForRingClosure = jchemhub.util.BondUtil.Orders.TRIPLE; - } + } else if (mychar == '(') { //alert(mychar); atomStack.push(lastNode); @@ -140,16 +140,16 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ lastNode = atomStack.pop(); bondOrder = bondStack.pop(); position++; - } + } else if (mychar >= '0' && mychar <= '9') { status = 2; chars[0] = mychar; currentSymbol = mychar; //new String(chars); thisRing = currentSymbol; - //Handle ring__________ + //Handle ring__________ var bondOrd = bondOrderForRingClosure; - if (ringbonds[thisRing] > bondOrd) + if (ringbonds[thisRing] > bondOrd) bondOrd = ringbonds[thisRing]; ringBond = null; ringPartner = null; @@ -164,7 +164,7 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ bondIsAromatic = false; rings[thisRing] = null; ringbonds[thisRing] = null; - } + } else { rings[thisRing] = lastNode; ringbonds[thisRing] = bondOrderForRingClosure; @@ -179,18 +179,18 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ pos=position+1; if (pos >= smiles.length - 1) throw "Percent sign ring closure numbers must be two-digit."; - + currentSymbol = smiles.substring(pos, pos + 2); - - if (currentSymbol.charAt(0) < '0' || currentSymbol.charAt(0) > '9' || + + if (currentSymbol.charAt(0) < '0' || currentSymbol.charAt(0) > '9' || currentSymbol.charAt(1) < '0' || currentSymbol.charAt(1) > '9') throw "Percent sign ring closure numbers must be two-digit."; thisRing = currentSymbol; - //Handle ring_______________ + //Handle ring_______________ var bondOrd = bondOrderForRingClosure; - if (ringbonds[thisRing] > bondOrd) + if (ringbonds[thisRing] > bondOrd) bondOrd = ringbonds[thisRing]; ringBond = null; ringPartner = null; @@ -205,7 +205,7 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ bondIsAromatic = false; rings[thisRing] = null; ringbonds[thisRing] = null; - } + } else { rings[thisRing] = lastNode; ringbonds[thisRing] = bondOrderForRingClosure; @@ -214,7 +214,7 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ //_____________ position += currentSymbol.length + 1; - } + } else if (mychar == '[') { currentSymbol = this.getAtomString(smiles, position); atom = this.assembleAtom(currentSymbol); @@ -265,7 +265,7 @@ jchemhub.smiles.SmilesParser.parse = function(smiles){ { throw "Invalid SMILES: found unexpected char: " + mychar; } - + } while (position < smiles.length) return molecule; @@ -333,7 +333,7 @@ jchemhub.smiles.SmilesParser.getElementSymbol = function(s,pos) { jchemhub.smiles.SmilesParser.getImplicitHydrogenCount = function(s,position) { - count = 0; + count = 0; if (s.charAt(position) == 'H') { multiplier = ""; while (position < (s.length - 1) && isDigit(s.charAt(position + 1))){ @@ -342,8 +342,8 @@ jchemhub.smiles.SmilesParser.getImplicitHydrogenCount = function(s,position) { } if (multiplier.length > 0) { count = parseInt(multiplier); - } - else count = -1; + } + else count = -1; } return count; } @@ -362,7 +362,7 @@ jchemhub.smiles.SmilesParser.assembleAtom = function(s) { currentSymbol = this.getElementSymbol(s, position); if (currentSymbol == null) { throw "Expected element symbol, found null!"; - } + } else { position = position + currentSymbol.length; if (currentSymbol.length == 1){ @@ -389,7 +389,7 @@ jchemhub.smiles.SmilesParser.assembleAtom = function(s) { break; } else throw "Invalid SMILES: found unexpected char: " + mychar; - } + } while (position < s.length); @@ -398,7 +398,7 @@ jchemhub.smiles.SmilesParser.assembleAtom = function(s) { //{ // atom.setMassNumber(Integer.parseInt(isotopicNumber.toString())); //} - + charge = 0; implicitHydrogens = 0; while (position < s.length) @@ -411,17 +411,17 @@ jchemhub.smiles.SmilesParser.assembleAtom = function(s) { if (implicitHydrogens >= 0) { position++; } - //TODO >> change atom class + //TODO >> change atom class //if (implicitHydrogens == -1) implicitHydrogens = 1; // atom.setHydrogenCount(implicitHydrogens); } else if (mychar == '+' || mychar == '-') { charge = getCharge(s, position); - position++; + position++; while (position < s.length && isDigit(s.charAt(position))) { position++; } - //TODO >> change atom class + //TODO >> change atom class atom.setFormalCharge(charge); } else if (mychar == '@') { diff --git a/jchemhub/smiles/smiles_parser_test.html b/jchemhub/smiles/smiles_parser_test.html index 672c39a..b108ff4 100644 --- a/jchemhub/smiles/smiles_parser_test.html +++ b/jchemhub/smiles/smiles_parser_test.html @@ -1,11 +1,11 @@ @@ -23,7 +23,7 @@ goog.require('jchemhub.ring.RingFinder'); - diff --git a/jchemhub/util/bond_util.js b/jchemhub/util/bond_util.js index 0d61166..79e5ee2 100644 --- a/jchemhub/util/bond_util.js +++ b/jchemhub/util/bond_util.js @@ -1,11 +1,11 @@ /* - * Copyright [2010] [Mark Rijnbeek] - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * Copyright [2010] [Mark Rijnbeek] + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and limitations under the License. */ diff --git a/jchemhub/view/arrow_renderer.js b/jchemhub/view/arrow_renderer.js index 7d2a9b3..6512be2 100644 --- a/jchemhub/view/arrow_renderer.js +++ b/jchemhub/view/arrow_renderer.js @@ -4,7 +4,7 @@ goog.require('jchemhub.view.Renderer'); /** * Class to render an Arrow object to a graphics object - * + * * @constructor * @param graphics * {goog.graphics.AbstractGraphics} graphics to draw on. @@ -19,15 +19,15 @@ goog.inherits(jchemhub.view.ArrowRenderer, jchemhub.view.Renderer); jchemhub.view.ArrowRenderer.prototype.render = function(coord, transform) { var w = this.config.get('arrow').width; var h = this.config.get('arrow').height; - + var nock = new goog.math.Coordinate(coord.x - w/2, coord.y); var tip = new goog.math.Coordinate(nock.x + w, nock.y); var head1 = new goog.math.Coordinate(tip.x-h, tip.y + h/2); var head2 = new goog.math.Coordinate(tip.x-h, tip.y - h/2); - + var path = new goog.graphics.Path(); var stroke = new goog.graphics.Stroke( - this.config.get("arrow").stroke.width, + this.config.get("arrow").stroke.width, this.config.get("arrow").stroke.color); var fill = null; var coords = transform.transformCoords( [ nock, @@ -39,7 +39,7 @@ jchemhub.view.ArrowRenderer.prototype.render = function(coord, transform) { path.moveTo(coords[1].x, coords[1].y); path.lineTo(coords[3].x, coords[3].y); - this.graphics.drawPath(path, stroke, fill); + this.graphics.drawPath(path, stroke, fill); } diff --git a/jchemhub/view/arrow_renderer_demo.html b/jchemhub/view/arrow_renderer_demo.html index ceb4d34..2d32716 100644 --- a/jchemhub/view/arrow_renderer_demo.html +++ b/jchemhub/view/arrow_renderer_demo.html @@ -3,7 +3,7 @@ jchemhub.view.ReactionRenderer - @@ -18,7 +18,7 @@ goog.require('jchemhub.graphics.AffineTransform'); @@ -23,12 +23,12 @@ goog.require('goog.debug.Console'); @@ -22,7 +22,7 @@ goog.require('jchemhub.model.SingleBond'); goog.require('jchemhub.model.SingleBondUp'); goog.require('jchemhub.model.SingleBondDown'); - goog.require('jchemhub.model.SingleBondUpOrDown'); + goog.require('jchemhub.model.SingleBondUpOrDown'); goog.require('jchemhub.model.DoubleBond'); goog.require('jchemhub.model.TripleBond'); goog.require('jchemhub.model.QuadrupleBond'); @@ -33,24 +33,24 @@ goog.require('goog.debug.Console'); @@ -23,7 +23,7 @@ goog.require('jchemhub.model.SingleBond'); goog.require('jchemhub.model.SingleBondUp'); goog.require('jchemhub.model.SingleBondDown'); - goog.require('jchemhub.model.SingleBondUpOrDown'); + goog.require('jchemhub.model.SingleBondUpOrDown'); goog.require('jchemhub.model.DoubleBond'); goog.require('jchemhub.model.TripleBond'); goog.require('jchemhub.model.QuadrupleBond'); @@ -34,18 +34,18 @@ goog.require('goog.debug.Console'); @@ -18,7 +18,7 @@ goog.require('jchemhub.graphics.AffineTransform'); @@ -21,10 +21,10 @@ goog.require('goog.debug.Console');