WeightedPathDescriptor extends AbstractMolecularDescriptor implements IMolecularDescriptor { public WeightedPathDescriptor() {} WeightedPathDescriptor(); @Override DescriptorSpecification getSpecification(); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames(); @Override String[] getParameterNames(); @Override Object getParameterType(String name); @Override DescriptorValue calculate(IAtomContainer container); @Override IDescriptorResult getDescriptorResultType();  }
@Test public void testWeightedPathDescriptor() throws ClassNotFoundException, CDKException, Exception { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = null; DescriptorValue value = null; DoubleArrayResult result = null; mol = sp.parseSmiles("CCCC"); value = descriptor.calculate(mol); result = (DoubleArrayResult) value.getValue(); Assert.assertEquals(6.871320, result.get(0), 0.000001); Assert.assertEquals(1.717830, result.get(1), 0.000001); Assert.assertEquals(0.0, result.get(2), 0.000001); Assert.assertEquals(0.0, result.get(3), 0.000001); Assert.assertEquals(0.0, result.get(4), 0.000001); String filename = "data/mdl/wpo.sdf"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); ISimpleChemObjectReader reader = new MDLV2000Reader(ins); IChemFile content = (IChemFile) reader.read(new org.openscience.cdk.ChemFile()); List cList = ChemFileManipulator.getAllAtomContainers(content); mol = (IAtomContainer) cList.get(0); mol = AtomContainerManipulator.removeHydrogens(mol); value = descriptor.calculate(mol); result = (DoubleArrayResult) value.getValue(); Assert.assertEquals(18.42026, result.get(0), 0.00001); Assert.assertEquals(1.842026, result.get(1), 0.00001); Assert.assertEquals(13.45733, result.get(2), 0.00001); Assert.assertEquals(13.45733, result.get(3), 0.00001); Assert.assertEquals(0, result.get(4), 0.00001); filename = "data/mdl/wpn.sdf"; ins = this.getClass().getClassLoader().getResourceAsStream(filename); reader = new MDLV2000Reader(ins); content = (IChemFile) reader.read(new org.openscience.cdk.ChemFile()); cList = ChemFileManipulator.getAllAtomContainers(content); mol = (IAtomContainer) cList.get(0); mol = AtomContainerManipulator.removeHydrogens(mol); value = descriptor.calculate(mol); result = (DoubleArrayResult) value.getValue(); Assert.assertEquals(26.14844, result.get(0), 0.00001); Assert.assertEquals(1.867746, result.get(1), 0.00001); Assert.assertEquals(19.02049, result.get(2), 0.00001); Assert.assertEquals(0, result.get(3), 0.000001); Assert.assertEquals(19.02049, result.get(4), 0.00001); }