CIPTool { public static ILigand[] getLigandLigands(ILigand ligand) { if (ligand instanceof TerminalLigand) return new ILigand[0]; IAtomContainer container = ligand.getAtomContainer(); IAtom ligandAtom = ligand.getLigandAtom(); IAtom centralAtom = ligand.getCentralAtom(); VisitedAtoms visitedAtoms = ligand.getVisitedAtoms(); List<IBond> bonds = container.getConnectedBondsList(ligandAtom); List<ILigand> ligands = new ArrayList<ILigand>(); for (IBond bond : bonds) { if (bond.contains(centralAtom)) { if (Order.SINGLE == bond.getOrder()) continue; int duplication = getDuplication(bond.getOrder()) - 1; if (duplication > 0) { for (int i = 1; i <= duplication; i++) { ligands.add(new TerminalLigand(container, visitedAtoms, ligandAtom, centralAtom)); } } } else { int duplication = getDuplication(bond.getOrder()); IAtom connectedAtom = bond.getOther(ligandAtom); if (visitedAtoms.isVisited(connectedAtom)) { ligands.add(new TerminalLigand(container, visitedAtoms, ligandAtom, connectedAtom)); } else { ligands.add(new Ligand(container, visitedAtoms, ligandAtom, connectedAtom)); } for (int i = 2; i <= duplication; i++) { ligands.add(new TerminalLigand(container, visitedAtoms, ligandAtom, connectedAtom)); } } } return ligands.toArray(new ILigand[0]); }  static CIP_CHIRALITY getCIPChirality(LigancyFourChirality stereoCenter); static void label(IAtomContainer container); static CIP_CHIRALITY getCIPChirality(IAtomContainer container, ITetrahedralChirality stereoCenter); static CIP_CHIRALITY getCIPChirality(IAtomContainer container, IDoubleBondStereochemistry stereoCenter); static boolean checkIfAllLigandsAreDifferent(ILigand[] ligands); static ILigand[] order(ILigand[] ligands); static LigancyFourChirality defineLigancyFourChirality(IAtomContainer container, int chiralAtom,
            int ligand1, int ligand2, int ligand3, int ligand4, Stereo stereo); static ILigand defineLigand(IAtomContainer container, VisitedAtoms visitedAtoms, int chiralAtom,
            int ligandAtom); static ILigand[] getLigandLigands(ILigand ligand); static final int HYDROGEN; }
@Test public void testGetLigandLigands() throws Exception { IAtomContainer molecule = smiles.parseSmiles("CC(C)C(CC)(C(C)(C)C)[H]"); ILigand ligand = CIPTool.defineLigand(molecule, new VisitedAtoms(), 3, 1); ILigand[] sideChains = CIPTool.getLigandLigands(ligand); Assert.assertEquals(2, sideChains.length); ligand = CIPTool.defineLigand(molecule, new VisitedAtoms(), 3, 4); sideChains = CIPTool.getLigandLigands(ligand); Assert.assertEquals(1, sideChains.length); ligand = CIPTool.defineLigand(molecule, new VisitedAtoms(), 3, 6); sideChains = CIPTool.getLigandLigands(ligand); Assert.assertEquals(3, sideChains.length); ligand = CIPTool.defineLigand(molecule, new VisitedAtoms(), 3, 10); sideChains = CIPTool.getLigandLigands(ligand); Assert.assertEquals(0, sideChains.length); }