/** * An aggregation of elements forms a molecule. * We consider neither the types of bonds nor the arrangement * of the molecule's elements; this class is only used to * store the types of elements that comprise a molecule. * @author Paul Gestwicki */ public class Molecule { /** * The elements that make up a molecule. * This member must be initialized in all constructors. */ private Element[] elements; /** * Construct a new molecule from the given elements. * @param elements an array of elements that make up this * molecule. */ Molecule(Element[] elements) { this.elements = new Element[elements.length]; System.arraycopy(elements, 0, this.elements, 0, elements.length); } }