/** * Create a ConformerContainer object from a single molecule object. * * Using this constructor, the resultant conformer container will * contain a single conformer. More conformers can be added using the * {@link #add} method. * * Note that the constructor will use the title of the input molecule * when adding new molecules as conformers. That is, the title of any molecule * to be added as a conformer should match the title of the input molecule. * * @param atomContainer The base molecule (or first conformer). */ public ConformerContainer(IAtomContainer atomContainer) { this.atomContainer = atomContainer; title = (String) atomContainer.getTitle(); coordinates = new ArrayList<Point3d[]>(); coordinates.add(getCoordinateList(atomContainer)); }
@Override public IAtomContainer set(int i, IAtomContainer atomContainer) { if (!title.equals(atomContainer.getTitle())) throw new IllegalArgumentException( "The input molecules does not have the same title as the other conformers"); Point3d[] tmp = getCoordinateList(atomContainer); IAtomContainer oldAtomContainer = get(i); coordinates.set(i, tmp); return oldAtomContainer; }
@Override public IAtomContainer set(int i, IAtomContainer atomContainer) { if (!title.equals(atomContainer.getTitle())) throw new IllegalArgumentException( "The input molecules does not have the same title as the other conformers"); Point3d[] tmp = getCoordinateList(atomContainer); IAtomContainer oldAtomContainer = get(i); coordinates.set(i, tmp); return oldAtomContainer; }
/** * Create a ConformerContainer object from a single molecule object. * * Using this constructor, the resultant conformer container will * contain a single conformer. More conformers can be added using the * {@link #add} method. * * Note that the constructor will use the title of the input molecule * when adding new molecules as conformers. That is, the title of any molecule * to be added as a conformer should match the title of the input molecule. * * @param atomContainer The base molecule (or first conformer). */ public ConformerContainer(IAtomContainer atomContainer) { this.atomContainer = atomContainer; title = (String) atomContainer.getTitle(); coordinates = new ArrayList<Point3d[]>(); coordinates.add(getCoordinateList(atomContainer)); }
/** * Create a ConformerContainer from an array of molecules. * * This constructor can be used when you have an array of conformers of a given * molecule. Note that this constructor will assume that all molecules in the * input array will have the same title. * * @param atomContainers The array of conformers */ public ConformerContainer(IAtomContainer[] atomContainers) { if (atomContainers.length == 0) throw new IllegalArgumentException("Can't use a zero-length molecule array"); // lets check that the titles match title = atomContainers[0].getTitle(); for (IAtomContainer atomContainer : atomContainers) { String nextTitle = atomContainer.getTitle(); if (title != null && !nextTitle.equals(title)) throw new IllegalArgumentException("Titles of all molecules must match"); } this.atomContainer = atomContainers[0]; coordinates = new ArrayList<Point3d[]>(); for (IAtomContainer container : atomContainers) { coordinates.add(getCoordinateList(container)); } }
/** * Create a ConformerContainer from an array of molecules. * * This constructor can be used when you have an array of conformers of a given * molecule. Note that this constructor will assume that all molecules in the * input array will have the same title. * * @param atomContainers The array of conformers */ public ConformerContainer(IAtomContainer[] atomContainers) { if (atomContainers.length == 0) throw new IllegalArgumentException("Can't use a zero-length molecule array"); // lets check that the titles match title = atomContainers[0].getTitle(); for (IAtomContainer atomContainer : atomContainers) { String nextTitle = atomContainer.getTitle(); if (title != null && !nextTitle.equals(title)) throw new IllegalArgumentException("Titles of all molecules must match"); } this.atomContainer = atomContainers[0]; coordinates = new ArrayList<Point3d[]>(); for (IAtomContainer container : atomContainers) { coordinates.add(getCoordinateList(container)); } }
@Override public void add(int i, IAtomContainer atomContainer) { if (this.atomContainer == null) { this.atomContainer = atomContainer; title = atomContainer.getTitle(); } if (!title.equals(atomContainer.getTitle())) throw new IllegalArgumentException( "The input molecules does not have the same title as the other conformers"); if (atomContainer.getAtomCount() != this.atomContainer.getAtomCount()) throw new IllegalArgumentException("Doesn't have the same number of atoms as the rest of the conformers"); Point3d[] tmp = getCoordinateList(atomContainer); coordinates.add(i, tmp); }
@Override public void add(int i, IAtomContainer atomContainer) { if (this.atomContainer == null) { this.atomContainer = atomContainer; title = atomContainer.getTitle(); } if (!title.equals(atomContainer.getTitle())) throw new IllegalArgumentException( "The input molecules does not have the same title as the other conformers"); if (atomContainer.getAtomCount() != this.atomContainer.getAtomCount()) throw new IllegalArgumentException("Doesn't have the same number of atoms as the rest of the conformers"); Point3d[] tmp = getCoordinateList(atomContainer); coordinates.add(i, tmp); }
throw new IllegalArgumentException("Doesn't have the same number of atoms as the rest of the conformers"); coordinates.add(getCoordinateList(atomContainer)); return true;
throw new IllegalArgumentException("Doesn't have the same number of atoms as the rest of the conformers"); coordinates.add(getCoordinateList(atomContainer)); return true;