topologicalmatrixtest.java

来自「化学图形处理软件」· Java 代码 · 共 47 行

JAVA
47
字号
package org.openscience.cdk.test.graph.matrix;import java.io.InputStream;import junit.framework.Test;import junit.framework.TestSuite;import org.openscience.cdk.ChemObject;import org.openscience.cdk.Molecule;import org.openscience.cdk.graph.matrix.TopologicalMatrix;import org.openscience.cdk.interfaces.IMolecule;import org.openscience.cdk.io.MDLReader;import org.openscience.cdk.test.CDKTestCase;/** * @cdk.module test-standard */public class TopologicalMatrixTest extends CDKTestCase {	public TopologicalMatrixTest(String name) {		super(name);	}	public static Test suite() {		return new TestSuite(TopologicalMatrixTest.class);	}	public void testTopologicalMatrix_IAtomContainer() throws Exception {		String filename = "data/mdl/clorobenzene.mol";		InputStream ins = this.getClass().getClassLoader().getResourceAsStream(				filename);		MDLReader reader = new MDLReader(ins);		IMolecule container = (Molecule) reader				.read((ChemObject) new Molecule());		int[][] matrix = TopologicalMatrix.getMatrix(container);		assertEquals(12, matrix.length);		for (int i = 0; i < matrix.length; i++) {			System.out.println("");			for (int j = 0; j < matrix.length; j++) {				System.out.print(matrix[i][j] + " ");			}		}	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?