Ejemplo n.º 1
0
 /**
  * Copies source to dest, copying the underlying data, so dest is a new, independent copy of
  * source. Does not contract before the copy.
  *
  * <p>Obtains synchronization locks on both source and dest (in that order) before performing the
  * copy.
  *
  * <p>Neither source nor dest may be null; otherwise a NullPointerException is thrown
  *
  * @param source ResizableDoubleArray to copy
  * @param dest ResizableArray to replace with a copy of the source array
  * @since 2.0
  */
 public static void copy(ResizableDoubleArray source, ResizableDoubleArray dest) {
   synchronized (source) {
     synchronized (dest) {
       dest.initialCapacity = source.initialCapacity;
       dest.contractionCriteria = source.contractionCriteria;
       dest.expansionFactor = source.expansionFactor;
       dest.expansionMode = source.expansionMode;
       dest.internalArray = new double[source.internalArray.length];
       System.arraycopy(source.internalArray, 0, dest.internalArray, 0, dest.internalArray.length);
       dest.numElements = source.numElements;
       dest.startIndex = source.startIndex;
     }
   }
 }