AtomDegreeDescriptor extends AbstractAtomicDescriptor implements IAtomicDescriptor { @Override public DescriptorValue calculate(IAtom atom, IAtomContainer container) { int atomDegree = 0; List<IAtom> neighboors = container.getConnectedAtomsList(atom); for (IAtom neighboor : neighboors) { if (!neighboor.getSymbol().equals("H")) atomDegree += 1; } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult( atomDegree), getDescriptorNames()); }  @Override DescriptorSpecification getSpecification(); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames(); @Override DescriptorValue calculate(IAtom atom, IAtomContainer container); @Override String[] getParameterNames(); @Override Object getParameterType(String name);  }
@Test public void testAtomDegreeDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { IAtomicDescriptor descriptor = new AtomDegreeDescriptor(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CC(C)CCCC"); Assert.assertEquals(3, ((IntegerResult) descriptor.calculate(mol.getAtom(1), mol).getValue()).intValue()); }