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); } }
double scalarValue = Double.parseDouble(currentChars); if (scalarValue == 1.0) { atomType.setMaxBondOrder(IBond.Order.SINGLE); } else if (scalarValue == 2.0) { atomType.setMaxBondOrder(IBond.Order.DOUBLE); } else if (scalarValue == 3.0) { atomType.setMaxBondOrder(IBond.Order.TRIPLE); } else if (scalarValue == 4.0) { atomType.setMaxBondOrder(IBond.Order.QUADRUPLE);
double scalarValue = Double.parseDouble(currentChars); if (scalarValue == 1.0) { atomType.setMaxBondOrder(IBond.Order.SINGLE); } else if (scalarValue == 2.0) { atomType.setMaxBondOrder(IBond.Order.DOUBLE); } else if (scalarValue == 3.0) { atomType.setMaxBondOrder(IBond.Order.TRIPLE); } else if (scalarValue == 4.0) { atomType.setMaxBondOrder(IBond.Order.QUADRUPLE);
/** * Method to test the clone() method */ @Test public void testClone_MaxBondOrder() throws Exception { IAtomType at = (IAtomType) newChemObject(); at.setMaxBondOrder(IBond.Order.SINGLE); IAtomType clone = (IAtomType) at.clone(); at.setMaxBondOrder(IBond.Order.DOUBLE); Assert.assertEquals(IBond.Order.SINGLE, clone.getMaxBondOrder()); }
@Test public void testSetMaxBondOrder_IBond_Order() { IAtomType at = (IAtomType) newChemObject(); at.setMaxBondOrder(IBond.Order.TRIPLE); Assert.assertEquals(IBond.Order.TRIPLE, at.getMaxBondOrder()); }
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()); }