/** * Creates a new object of the same class as this object. * * @return a clone of this instance. * @exception OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since vecmath 1.3 */ public Object clone() { GVector v1 = null; try { v1 = (GVector) super.clone(); } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(); } // Also need to clone array of values v1.values = new double[length]; for (int i = 0; i < length; i++) { v1.values[i] = values[i]; } return v1; }