private void endAtomTypeElement(String local) { if ("AtomType".equals(local)) { atomTypes.add(currentAtomType); currentAtomType.setProperty(CDKConstants.PI_BOND_COUNT, piBondCount); currentAtomType.setFormalNeighbourCount(neighborCount); if (maxBondOrder != Order.UNSET) currentAtomType.setMaxBondOrder(maxBondOrder); if (bondOrderSum > 0.1) currentAtomType.setBondOrderSum(bondOrderSum); } else if ("formalCharge".equals(local)) { if (currentChars.charAt(0) == '+') { currentChars = currentChars.substring(1); } currentAtomType.setFormalCharge(Integer.parseInt(currentChars)); } else if ("formalNeighbourCount".equals(local)) { neighborCount = Integer.parseInt(currentChars); } else if ("lonePairCount".equals(local)) { currentAtomType.setProperty(CDKConstants.LONE_PAIR_COUNT, Integer.parseInt(currentChars)); } else if ("singleElectronCount".equals(local)) { currentAtomType.setProperty(CDKConstants.SINGLE_ELECTRON_COUNT, Integer.parseInt(currentChars)); } else if ("piBondCount".equals(local)) { piBondCount = Integer.parseInt(currentChars); } }
private void endAtomTypeElement(String local) { if ("AtomType".equals(local)) { atomTypes.add(currentAtomType); currentAtomType.setProperty(CDKConstants.PI_BOND_COUNT, piBondCount); currentAtomType.setFormalNeighbourCount(neighborCount); if (maxBondOrder != Order.UNSET) currentAtomType.setMaxBondOrder(maxBondOrder); if (bondOrderSum > 0.1) currentAtomType.setBondOrderSum(bondOrderSum); } else if ("formalCharge".equals(local)) { if (currentChars.charAt(0) == '+') { currentChars = currentChars.substring(1); } currentAtomType.setFormalCharge(Integer.parseInt(currentChars)); } else if ("formalNeighbourCount".equals(local)) { neighborCount = Integer.parseInt(currentChars); } else if ("lonePairCount".equals(local)) { currentAtomType.setProperty(CDKConstants.LONE_PAIR_COUNT, Integer.parseInt(currentChars)); } else if ("singleElectronCount".equals(local)) { currentAtomType.setProperty(CDKConstants.SINGLE_ELECTRON_COUNT, Integer.parseInt(currentChars)); } else if ("piBondCount".equals(local)) { piBondCount = Integer.parseInt(currentChars); } }
} else if ("formalCharge".equals(atts.getQName(i))) { try { atomType.setFormalCharge(Integer.parseInt(atts.getValue(i))); } catch (NumberFormatException exception) { logger.error("Value of <atom> @", atts.getQName(i), " is not an integer: ", atts.getValue(i));
} else if ("formalCharge".equals(atts.getQName(i))) { try { atomType.setFormalCharge(Integer.parseInt(atts.getValue(i))); } catch (NumberFormatException exception) { logger.error("Value of <atom> @", atts.getQName(i), " is not an integer: ", atts.getValue(i));
/** * Method to test the clone() method */ @Test public void testClone_FormalCharge() throws Exception { IAtomType at = (IAtomType) newChemObject(); at.setFormalCharge(1); IAtomType clone = (IAtomType) at.clone(); at.setFormalCharge(2); Assert.assertEquals(1, clone.getFormalCharge().intValue()); }
@Test public void testSetFormalCharge_Integer() { int charge = 1; IAtomType a = (IAtomType) newChemObject(); a.setFormalCharge(charge); Assert.assertEquals(charge, a.getFormalCharge().intValue()); }
atomType.setValency(Integer.parseInt(currentChars)); } else if (scalarType == SCALAR_FORMALCHARGE) { atomType.setFormalCharge(Integer.parseInt(currentChars)); } else if (scalarType == SCALAR_HYBRIDIZATION) { if ("sp1".equals(currentChars)) {
atomType.setValency(Integer.parseInt(currentChars)); } else if (scalarType == SCALAR_FORMALCHARGE) { atomType.setFormalCharge(Integer.parseInt(currentChars)); } else if (scalarType == SCALAR_HYBRIDIZATION) { if ("sp1".equals(currentChars)) {
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()); }
atomType.setFormalCharge(atom.getFormalCharge()); if (atom.getFlag(CDKConstants.ISAROMATIC)) atomType.setFlag(CDKConstants.ISAROMATIC, true);