private static Atom[] getAtoms(Atom[] ca, int[] positions, int length, boolean clone) { List<Atom> atoms = new ArrayList<Atom>(); for (int i = 0; i < length; i++) { int p = positions[i]; Atom a; if (clone) { a = (Atom) ca[p].clone(); a.setGroup((Group) ca[p].getGroup().clone()); } else { a = ca[p]; } atoms.add(a); } return atoms.toArray(new Atom[atoms.size()]); }
/** * Copies the first length atoms from the input array * @param ca The array to copy * @param length the number of atoms to copy * @param clone If true, preform a deep copy, cloning the underlying Groups * @return An array with the first length items of ca, possibly cloning the Atoms. * @throws StructureException */ private Atom[] getAtoms(Atom[] ca, int length, boolean clone) throws StructureException{ List<Atom> atoms = new ArrayList<Atom>(); for ( int i = 0 ; i < length ; i++){ Atom a; if ( clone ){ Group g = (Group)ca[i].getGroup().clone(); a = g.getAtom(ca[i].getName()); } else { a = ca[i]; } atoms.add(a); } return atoms.toArray(new Atom[atoms.size()]); }
/** * Copies the first length atoms from the input array * @param ca The array to copy * @param length the number of atoms to copy * @param clone If true, preform a deep copy, cloning the underlying Groups * @return An array with the first length items of ca, possibly cloning the Atoms. * @throws StructureException */ private Atom[] getAtoms(Atom[] ca, int length, boolean clone) throws StructureException{ List<Atom> atoms = new ArrayList<Atom>(); for ( int i = 0 ; i < length ; i++){ Atom a; if ( clone ){ Group g = (Group)ca[i].getGroup().clone(); a = g.getAtom(ca[i].getName()); } else { a = ca[i]; } atoms.add(a); } return atoms.toArray(new Atom[atoms.size()]); }
private void rot_mol(Atom[] caA, Atom[] caB, int nse2, Matrix m , Atom shift) throws StructureException{ for(int l=0; l<nse2; l++) { Atom a = caA[l]; Group g = (Group)a.getGroup().clone(); //Group g = (Group)a.getParent(); Calc.rotate( g, m); Calc.shift( g, shift); caB[l] = g.getAtom(a.getName()); } }
private void rot_mol(Atom[] caA, Atom[] caB, int nse2, Matrix m , Atom shift) throws StructureException{ for(int l=0; l<nse2; l++) { Atom a = caA[l]; Group g = (Group)a.getGroup().clone(); //Group g = (Group)a.getParent(); Calc.rotate( g, m); Calc.shift( g, shift); caB[l] = g.getAtom(a.getName()); } }
seqResGroups.add((Group)seqResChain.getAtomGroups().get(i).clone());
return group; Group altLocG = (Group) group.clone();
Group ng = (Group) parentG.clone(); newGroup[apos] = ng; newChain.addGroup(ng);
Group altLocG = (Group) currentGroup.clone();
Group altLocG = (Group) currentGroup.clone();
Group newG = (Group) g.clone();
Group parentN = (Group) parentG.clone();
@Override public Object clone() { NucleotideImpl n = new NucleotideImpl(); n.setPDBFlag(has3D()); n.setResidueNumber(getResidueNumber()); n.setPDBName(getPDBName()); //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; } }
/** returns and identical copy of this Group object . * @return and identical copy of this Group object */ @Override public Object clone() { HetatomImpl n = new HetatomImpl(); n.setPDBFlag(has3D()); n.setResidueNumber(residueNumber); n.setPDBName(getPDBName()); //clone atoms and bonds. cloneAtomsAndBonds(n); // copying the alt loc groups if present, otherwise they stay null if (altLocs!=null) { for (Group altLocGroup:this.altLocs) { Group nAltLocGroup = (Group)altLocGroup.clone(); n.addAltLoc(nAltLocGroup); } } if (chemComp!=null) n.setChemComp(chemComp); return n; }
/** 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; }
Group g1 = (Group)g.clone(); g1.clearAtoms(); g1.addAtom(a);
Group g = (Group)a.getGroup().clone(); // works because each group has only a CA atom