📄 normalizertest.java
字号:
/* $RCSfile$ * $Author: egonw $ * $Date: 2007-01-04 17:32:54 +0000 (Do, 04 Jan 2007) $ * $Revision: 7635 $ * * Copyright (C) 1997-2007 The Chemistry Development Kit (CDK) project * * Contact: cdk-devel@lists.sourceforge.net * * This program 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 program 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 program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */package org.openscience.cdk.test.tools;import javax.xml.parsers.DocumentBuilder;import javax.xml.parsers.DocumentBuilderFactory;import javax.xml.parsers.ParserConfigurationException;import junit.framework.Test;import junit.framework.TestSuite;import org.openscience.cdk.Atom;import org.openscience.cdk.Bond;import org.openscience.cdk.Molecule;import org.openscience.cdk.test.CDKTestCase;import org.openscience.cdk.tools.Normalizer;import org.w3c.dom.Document;import org.w3c.dom.Element;/** * @cdk.module test-smiles */public class NormalizerTest extends CDKTestCase { public NormalizerTest(String name) { super(name); } public void setUp() {} public static Test suite() { return new TestSuite(NormalizerTest.class); } public void testNormalize() throws ParserConfigurationException, Exception{ Molecule ac=new Molecule(); ac.addAtom(new Atom("C")); ac.addAtom(new Atom("N")); ac.addAtom(new Atom("O")); ac.addAtom(new Atom("O")); ac.addBond(new Bond(ac.getAtom(0),ac.getAtom(1))); ac.addBond(new Bond(ac.getAtom(1),ac.getAtom(2),2)); ac.addBond(new Bond(ac.getAtom(1),ac.getAtom(3),2)); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); Element set = doc.createElement("replace-set"); doc.appendChild(set); Element replace=doc.createElement("replace"); set.appendChild(replace); replace.appendChild(doc.createTextNode("O=N=O")); Element replacement=doc.createElement("replacement"); set.appendChild(replacement); replacement.appendChild(doc.createTextNode("[O-][N+]=O")); Normalizer.normalize(ac,doc); assertTrue(ac.getBond(1).getOrder()==1 ^ ac.getBond(2).getOrder()==1); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -