private static IAtom unbox(IAtom atom) { while (atom instanceof AtomRef) atom = ((AtomRef) atom).deref(); return atom; }
/** * {@inheritDoc} */ @Override public List<IAtom> getConnectedAtomsList(IAtom atom) { AtomRef aref = getAtomRef(atom); List<IAtom> nbrs = new ArrayList<>(aref.getBondCount()); for (IBond bond : aref.bonds()) { nbrs.add(bond.getOther(atom)); } return nbrs; }
/** * {@inheritDoc} */ @Override public IBond getBond(IAtom beg, IAtom end) { final AtomRef begref = getAtomRefUnsafe(beg); return begref != null ? begref.getBond(end) : null; }
AtomRef atomref = getAtomRefUnsafe(atom); if (atomref != null) { if (atomref.getBondCount() > 0) { removeAtomOnly(atomref.getIndex());
/** * {@inheritDoc} */ @Override public int indexOf(IAtom atom) { final AtomRef aref = getAtomRefUnsafe(atom); return aref == null ? -1 : aref.getIndex(); }
/** * {@inheritDoc} */ @Override public List<IElectronContainer> getConnectedElectronContainersList( IAtom atom) { List<IElectronContainer> ecs = new ArrayList<>(); AtomRef aref = getAtomRef(atom); for (IBond bond : aref.bonds()) { ecs.add(bond); } for (int i = 0; i < numLonePairs; i++) { if (lonepairs[i].contains(atom)) ecs.add(lonepairs[i]); } for (int i = 0; i < numSingleElectrons; i++) { if (electrons[i].contains(atom)) ecs.add(electrons[i]); } return ecs; }
AtomRef atomref = getAtomRefUnsafe(atom); if (atomref != null) { if (atomref.getBondCount() > 0) { removeAtomOnly(atomref.getIndex());
/** * {@inheritDoc} */ @Override public int indexOf(IAtom atom) { final AtomRef aref = getAtomRefUnsafe(atom); return aref == null ? -1 : aref.getIndex(); }
/** * {@inheritDoc} */ @Override public List<IElectronContainer> getConnectedElectronContainersList( IAtom atom) { List<IElectronContainer> ecs = new ArrayList<>(); AtomRef aref = getAtomRef(atom); for (IBond bond : aref.bonds()) { ecs.add(bond); } for (int i = 0; i < numLonePairs; i++) { if (lonepairs[i].contains(atom)) ecs.add(lonepairs[i]); } for (int i = 0; i < numSingleElectrons; i++) { if (electrons[i].contains(atom)) ecs.add(electrons[i]); } return ecs; }
/** * Utility method to dereference an atom. If the atom is not * an {@link AtomRef} it simply returns the input. * * @param atom the atom * @return non-pointer atom */ public static IAtom deref(IAtom atom) { while (atom instanceof AtomRef) atom = ((AtomRef) atom).deref(); return atom; }
/** * {@inheritDoc} */ @Override public List<IAtom> getConnectedAtomsList(IAtom atom) { AtomRef aref = getAtomRef(atom); List<IAtom> nbrs = new ArrayList<>(aref.getBondCount()); for (IBond bond : aref.bonds()) { nbrs.add(bond.getOther(atom)); } return nbrs; }
AtomRef atomref = getAtomRefUnsafe(atom); if (atomref != null) { if (atomref.getBondCount() > 0) { removeAtomOnly(atomref.getIndex());
/** * {@inheritDoc} */ @Override public IBond getBond(IAtom beg, IAtom end) { final AtomRef begref = getAtomRefUnsafe(beg); return begref != null ? begref.getBond(end) : null; }
/** * {@inheritDoc} */ @Override public int indexOf(IAtom atom) { final AtomRef aref = getAtomRefUnsafe(atom); return aref == null ? -1 : aref.getIndex(); }
/** * {@inheritDoc} */ @Override public List<IElectronContainer> getConnectedElectronContainersList( IAtom atom) { List<IElectronContainer> ecs = new ArrayList<>(); AtomRef aref = getAtomRef(atom); for (IBond bond : aref.bonds()) { ecs.add(bond); } for (int i = 0; i < numLonePairs; i++) { if (lonepairs[i].contains(atom)) ecs.add(lonepairs[i]); } for (int i = 0; i < numSingleElectrons; i++) { if (electrons[i].contains(atom)) ecs.add(electrons[i]); } return ecs; }
private static IAtom unbox(IAtom atom) { while (atom instanceof AtomRef) atom = ((AtomRef) atom).deref(); return atom; }
/** * {@inheritDoc} */ @Override public List<IAtom> getConnectedAtomsList(IAtom atom) { AtomRef aref = getAtomRef(atom); List<IAtom> nbrs = new ArrayList<>(aref.getBondCount()); for (IBond bond : aref.bonds()) { nbrs.add(bond.getOther(atom)); } return nbrs; }
AtomRef atomref = getAtomRefUnsafe(atom); if (atomref != null) { if (atomref.getBondCount() > 0) { removeAtomOnly(atomref.getIndex());