for (int i = 0; i < atts.getLength(); i++) { if ("id".equals(atts.getQName(i))) { atomType.setAtomTypeName(atts.getValue(i)); atomType.setID(atomType.getAtomTypeName()); atomType.setAtomTypeName(atts.getValue(i));
for (int i = 0; i < atts.getLength(); i++) { if ("id".equals(atts.getQName(i))) { atomType.setAtomTypeName(atts.getValue(i)); atomType.setID(atomType.getAtomTypeName()); atomType.setAtomTypeName(atts.getValue(i));
Color co = new Color(rl, gl, bl); atomType.setProperty("org.openscience.cdk.renderer.color", co); atomType.setAtomTypeName(sid); atomTypes.add(atomType);
Color co = new Color(rl, gl, bl); atomType.setProperty("org.openscience.cdk.renderer.color", co); atomType.setAtomTypeName(sid); atomTypes.add(atomType);
Color co = new Color(rl, gl, bl); atomType.setProperty("org.openscience.cdk.renderer.color", co); atomType.setAtomTypeName(sid); atomTypes.add(atomType);
Color co = new Color(rl, gl, bl); atomType.setProperty("org.openscience.cdk.renderer.color", co); atomType.setAtomTypeName(sid); atomTypes.add(atomType);
currentAtomType = builder.newInstance(IAtomType.class, "H"); currentAtomType.setAtomicNumber(null); currentAtomType.setAtomTypeName(atts.getValue("rdf:ID")); piBondCount = 0; neighborCount = 0;
currentAtomType = builder.newInstance(IAtomType.class, "H"); currentAtomType.setAtomicNumber(null); currentAtomType.setAtomTypeName(atts.getValue("rdf:ID")); piBondCount = 0; neighborCount = 0;
@Test public void testToString_AtomTypeName() { IAtomType at = (IAtomType) newChemObject(); at.setAtomTypeName("N.sp2.3"); String description = at.toString(); Assert.assertTrue(description.contains("N.sp2.3")); }
@Test public void unknownAtomTypeDoesNotModifyProperties() { IAtom atom = new Atom(Elements.CARBON); IAtomType atomType = new AtomType(Elements.Unknown.toIElement()); atomType.setAtomTypeName("X"); AtomTypeManipulator.configure(atom, atomType); assertThat(atom.getSymbol(), is("C")); assertThat(atom.getAtomicNumber(), is(6)); }
@Test public void testGetAtomTypeName() { IAtomType at = (IAtomType) newChemObject(); at.setAtomTypeName("C4"); Assert.assertEquals("C4", at.getAtomTypeName()); }
@Test public void testSetAtomTypeName_String() { IAtomType at = (IAtomType) newChemObject(); at.setAtomTypeName("C4"); Assert.assertEquals("C4", at.getAtomTypeName()); }
private static void deserializeAtomTypeFields(Resource rdfObject, IAtomType element) { deserializeIsotopeFields(rdfObject, element); Statement hybrid = rdfObject.getProperty(CDK.HASHYBRIDIZATION); if (hybrid != null) { Resource rdfHybrid = (Resource) hybrid.getObject(); if (RESOURCE_TO_HYBRID.containsKey(rdfHybrid)) { element.setHybridization(RESOURCE_TO_HYBRID.get(rdfHybrid)); } } Statement name = rdfObject.getProperty(CDK.HASATOMTYPENAME); if (name != null) { element.setAtomTypeName(name.getString()); } Statement order = rdfObject.getProperty(CDK.HASMAXBONDORDER); if (order != null) { Resource maxOrder = (Resource) order.getResource(); element.setMaxBondOrder(resource2Order(maxOrder)); } Statement formalCharge = rdfObject.getProperty(CDK.HASFORMALCHARGE); if (formalCharge != null) element.setFormalCharge(formalCharge.getInt()); }
private static void deserializeAtomTypeFields(Resource rdfObject, IAtomType element) { deserializeIsotopeFields(rdfObject, element); Statement hybrid = rdfObject.getProperty(CDK.HASHYBRIDIZATION); if (hybrid != null) { Resource rdfHybrid = (Resource) hybrid.getObject(); if (RESOURCE_TO_HYBRID.containsKey(rdfHybrid)) { element.setHybridization(RESOURCE_TO_HYBRID.get(rdfHybrid)); } } Statement name = rdfObject.getProperty(CDK.HASATOMTYPENAME); if (name != null) { element.setAtomTypeName(name.getString()); } Statement order = rdfObject.getProperty(CDK.HASMAXBONDORDER); if (order != null) { Resource maxOrder = (Resource) order.getResource(); element.setMaxBondOrder(resource2Order(maxOrder)); } Statement formalCharge = rdfObject.getProperty(CDK.HASFORMALCHARGE); if (formalCharge != null) element.setFormalCharge(formalCharge.getInt()); }
/** * @cdk.bug 1322 */ @Test public void aromaticityIsNotOverwritten() { IAtom atom = new Atom(Elements.CARBON); atom.setFlag(CDKConstants.ISAROMATIC, true); IAtomType atomType = new AtomType(Elements.Unknown.toIElement()); atomType.setFlag(CDKConstants.ISAROMATIC, false); atomType.setAtomTypeName("C.sp3"); AtomTypeManipulator.configure(atom, atomType); assertThat(atom.getFlag(CDKConstants.ISAROMATIC), is(true)); }
/** * @cdk.bug 1322 */ @Test public void aromaticitySetIfForType() { IAtom atom = new Atom(Elements.CARBON); atom.setFlag(CDKConstants.ISAROMATIC, false); IAtomType atomType = new AtomType(Elements.Unknown.toIElement()); atomType.setFlag(CDKConstants.ISAROMATIC, true); atomType.setAtomTypeName("C.am"); AtomTypeManipulator.configure(atom, atomType); assertThat(atom.getFlag(CDKConstants.ISAROMATIC), is(true)); } }
/** * Test for bug #1309731. */ @Test public void testAtomTypeNameAndIDBug() { IAtomType a = (IAtomType) newChemObject(); a.setID("carbon1"); a.setAtomTypeName("C.sp3"); Assert.assertEquals("carbon1", a.getID()); }
@Test public void testPerceiveAtomTypesAndConfigureUnsetProperties() throws Exception { IAtomContainer container = new AtomContainer(); IAtom atom = new Atom("C"); atom.setExactMass(13.0); container.addAtom(atom); IAtomType type = new AtomType("C"); type.setAtomTypeName("C.sp3"); type.setExactMass(12.0); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(container); Assert.assertNotNull(atom.getExactMass()); Assert.assertEquals(13.0, atom.getExactMass(), 0.1); Assert.assertNotNull(atom.getAtomTypeName()); Assert.assertEquals("C.sp3", atom.getAtomTypeName()); }