/** returns and identical copy of this Group object . * @return and identical copy of this Group object */ @Override public Object clone() { AminoAcidImpl n = new AminoAcidImpl(); n.setPDBFlag(has3D()); n.setResidueNumber(getResidueNumber()); n.setPDBName(getPDBName()); n.setAminoType(getAminoType()); n.setRecordType(recordType); //clone atoms and bonds. cloneAtomsAndBonds(n); // copying the alt loc groups if present, otherwise they stay null if (getAltLocs()!=null && !getAltLocs().isEmpty()) { for (Group altLocGroup:this.getAltLocs()) { Group nAltLocGroup = (Group)altLocGroup.clone(); n.addAltLoc(nAltLocGroup); } } if (chemComp!=null) n.setChemComp(chemComp); return n; }