public void setChemObject(IChemObject object) { if (object instanceof IAtom) { source = object; // update table contents IAtom atom = (IAtom)source; symbolField.setText(atom.getSymbol()); hCountField.setValue(new Integer(atom.getImplicitHydrogenCount()==null ? 0 : atom.getImplicitHydrogenCount())); formalChargeField.setValue(new Integer(atom.getFormalCharge())); if(atom.getProperty(CDKConstants.COMMENT)!=null) commentField.setText((String)(atom.getProperty(CDKConstants.COMMENT))); try { IIsotope isotope = XMLIsotopeFactory.getInstance( atom.getBuilder()).getMajorIsotope( atom.getSymbol()); majorIsotopeNumber = isotope.getMassNumber(); isotopeField.setValue(atom.getMassNumber()-majorIsotopeNumber); } catch (Exception exception) { logger.error("Error while configuring atom"); logger.debug(exception); isotopeField.setValue(0); } } else { throw new IllegalArgumentException("Argument must be an Atom"); } }
public boolean showCarbon( IAtom atom, IAtomContainer ac, JChemPaintRendererModel model) { Integer massNumber = atom.getMassNumber(); if (massNumber != null) { try { Integer expectedMassNumber = XMLIsotopeFactory.getInstance(ac.getBuilder()) .getMajorIsotope(atom.getSymbol()) .getMassNumber(); if (massNumber != expectedMassNumber) return true; } catch (IOException e) { logger.warn(e); } } return super.showCarbon(atom, ac, model); } }
wholeModel .addIsotope(XMLIsotopeFactory.getInstance( wholeModel.getBuilder()).getMajorIsotope(1), implicitHs); } catch (IOException e) {
@Test public void testGetMajorIsotope_String() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope isotope = isofac.getMajorIsotope("Te"); if (standAlone) System.out.println("Isotope: " + isotope); Assert.assertEquals(129.9062244, isotope.getExactMass(), 0.0001); }
if (implicitHs > 0) wholeModel.addIsotope(XMLIsotopeFactory.getInstance( wholeModel.getBuilder()).getMajorIsotope(1), implicitHs); } catch (IOException e) {
@Test public void testGetMajorIsotope_Nonelement() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope isotope = isofac.getMajorIsotope("E"); Assert.assertNull(isotope); }
@Test public void testGetMajorIsotope_int() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope isotope = isofac.getMajorIsotope(17); Assert.assertEquals("Cl", isotope.getSymbol()); }
IIsotope isotope = XMLIsotopeFactory.getInstance( atom.getBuilder()).getMajorIsotope( atom.getSymbol()); isotopeNumber = isotope.getMassNumber();
try { IIsotope isotope = XMLIsotopeFactory.getInstance( atom.getBuilder()).getMajorIsotope( atom.getSymbol()); if(isotope!=null)