@Override public void setAtoms(IAtom[] atoms) { assert atoms.length == 2; super.setAtoms(atoms); // check for swap: intended ref check if (atoms[0] == end && atoms[1] == beg) { BaseAtomRef tmp = beg; beg = end; end = tmp; return; } if (beg != null) beg.bonds.remove(this); if (end != null) end.bonds.remove(this); beg = mol.getAtomRef(atoms[0]); end = mol.getAtomRef(atoms[1]); beg.bonds.add(this); end.bonds.add(this); }
@Override public void setAtoms(IAtom[] atoms) { assert atoms.length == 2; super.setAtoms(atoms); // check for swap: intended ref check if (atoms[0] == end && atoms[1] == beg) { BaseAtomRef tmp = beg; beg = end; end = tmp; return; } if (beg != null) beg.bonds.remove(this); if (end != null) end.bonds.remove(this); beg = mol.getAtomRef(atoms[0]); end = mol.getAtomRef(atoms[1]); beg.bonds.add(this); end.bonds.add(this); }
@Override public void setAtoms(IAtom[] atoms) { assert atoms.length == 2; super.setAtoms(atoms); // check for swap: intended ref check if (Objects.equals(atoms[0], end) && Objects.equals(atoms[1], beg)) { BaseAtomRef tmp = beg; beg = end; end = tmp; return; } if (beg != null) beg.bonds.remove(this); if (end != null) end.bonds.remove(this); beg = mol.getAtomRef(atoms[0]); end = mol.getAtomRef(atoms[1]); beg.bonds.add(this); end.bonds.add(this); }
@Override public void setAtoms(IAtom[] atoms) { assert atoms.length == 2; super.setAtoms(atoms); // check for swap: intended ref check if (Objects.equals(atoms[0], end) && Objects.equals(atoms[1], beg)) { BaseAtomRef tmp = beg; beg = end; end = tmp; return; } if (beg != null) beg.bonds.remove(this); if (end != null) end.bonds.remove(this); beg = mol.getAtomRef(atoms[0]); end = mol.getAtomRef(atoms[1]); beg.bonds.add(this); end.bonds.add(this); }