Michael Thomas Flanagan's Java Scientific Library

DeepCopy Class:      Deep Copy of Arrays and of an Object

     

Last update of this class: 11 April 2012
Main Page of Michael Thomas Flanagan's Java Scientific Library

This class contains methods for the deep copying of:
import directive: import flanagan.math.DeepCopy;

SUMMARY OF METHODS

Deep Copying of Objects Deep copy of an Object public static Object copy(Object obj)
public static Object copyObject(Object obj)
Deep copy a 1-D array public static double[] copy(double[] array)
public static float[] copy(float[] array)
public static long[] copy(long[] array)
public static int[] copy(int[] array)
public static short[] copy(short[] array)
public static byte[] copy(byte[] array)
public static char[] copy(char[] array)
public static String[] copy(String[] array)
public static BigDecimal[] copy(BigDecimal[] array)
public static BigInteger[] copy(BigInteger[] array)
public static Complex[] copy(Complex[] array)
public static Point[] copy(Point[] array)
public static VectorMaths[] copy(VectorMaths[] array)
public static ArrayMaths[] copy(ArrayMaths[] array)
public static Matrix[] copy(Matrix[] array)
public static ComplexMatrix[] copy(PComplexMatrix[] array)
public static Polynomial[] copy(Polynomial[] array)
public static ComplexPoly[] copy(ComplexPoly[] array)
public static Phasor[] copy(Phasor[] array)
public static ErrorProp[] copy(ErrorProp[] array)
public static ComplexErrorProp[] copy(ComplexErrorProp[] array)
public static Double[] copy(Double[] array)
public static Float[] copy(Float[] array)
public static Long[] copy(Long[] array)
public static Integer[] copy(Integer[] array)
public static Short[] copy(Short[] array)
public static Byte[] copy(Byte[] array)
public static Character[] copy(Character[] array)
Deep copy a 2-D array public static double[][] copy(double[][] array)
public static float[][] copy(float[][] array)
public static long[][] copy(long[][] array)
public static int[][] copy(int[][] array)
public static short[][] copy(short[][] array)
public static byte[][] copy(byte[][] array)
public static char[][] copy(char[][] array)
public static String[][] copy(String[][] array)
public static BigDecimal[][] copy(BigDecimal[][] array)
public static BigInteger[][] copy(BigInteger[][] array)
public static Complex[][] copy(Complex[][] array)
public static Point[][] copy(Point[][] array)
public static VectorMaths[][] copy(VectorMaths[][] array)
public static ArrayMaths[][] copy(ArrayMaths[][] array)
public static Matrix[][] copy(Matrix[] array)
public static ComplexMatrix[] copy(PComplexMatrix[][] array)
public static Polynomial[][] copy(Polynomial[][] array)
public static ComplexPoly[][] copy(ComplexPoly[][] array)
public static Phasor[][] copy(Phasor[][] array)
public static ErrorProp[][] copy(ErrorProp[][] array)
public static ComplexErrorProp[][] copy(ComplexErrorProp[][] array)
public static Double[][] copy(Double[][] array)
public static Float[][] copy(Float[][] array)
public static Long[][] copy(Long[][] array)
public static Integer[][] copy(Integer[][] array)
public static Short[][] copy(Short[][] array)
public static Byte[][] copy(Byte[][] array)
public static Character[][] copy(Character[][] array)
Deep copy a 3-D array public static double[][][] copy(double[][][] array)
public static float[][][] copy(float[][][] array)
public static long[][][] copy(long[][][] array)
public static int[][][] copy(int[][][] array)
public static short[][][] copy(short[][][] array)
public static byte[][][] copy(byte[][][] array)
public static char[][][] copy(char[][][] array)
public static String[][][] copy(String[][][] array)
public static BigDecimal[][][] copy(BigDecimal[][][] array)
public static BigInteger[][][] copy(BigInteger[][][] array)
public static Complex[][][] copy(Complex[][][] array)
public static Point[][][] copy(Point[][][] array)
public static VectorMaths[][][] copy(VectorMaths[][][] array)
public static ArrayMaths[][][] copy(ArrayMaths[][][] array)
public static Matrix[][][] copy(Matrix[][][] array)
public static ComplexMatrix[][][] copy(PComplexMatrix[][][] array)
public static Polynomial[][][] copy(Polynomial[][][] array)
public static ComplexPoly[][][] copy(ComplexPoly[][][] array)
public static Phasor[][][] copy(Phasor[][][] array)
public static ErrorProp[][][] copy(ErrorProp[][][] array)
public static ComplexErrorProp[][][] copy(ComplexErrorProp[][][] array)
public static Double[][][] copy(Double[][][] array)
public static Float[][][] copy(Float[][][] array)
public static Long[][][] copy(Long[][][] array)
public static Integer[][][] copy(Integer[][][] array)
public static Short[][][] copy(Short[][][] array)
public static Byte[][][] copy(Byte[][][] array)
public static Character[][][] copy(Character[][][] array)
Deep copy a 4-D array public static double[][][][] copy(double[][][][] array)
public static float[][][][] copy(float[][][][] array)
public static long[][][][] copy(long[][][][] array)
public static int[][][][] copy(int[][][][] array)
public static short[][][][] copy(short[][][][] array)
public static byte[][][][] copy(byte[][][][] array)
public static char[][][][] copy(char[][][][] array)
public static String[][][][] copy(String[][][][] array)
public static BigDecimal[][][][] copy(BigDecimal[][][][] array)
public static BigInteger[][][][] copy(BigInteger[][][][] array)
public static Complex[][][][] copy(Complex[][][][] array)
public static Point[][][][] copy(Point[][][][] array)
public static VectorMaths[][][][] copy(VectorMaths[][][][] array)
public static ArrayMaths[][][][] copy(ArrayMaths[][][][] array)
public static Matrix[][][][] copy(Matrix[][][][] array)
public static ComplexMatrix[][][][] copy(PComplexMatrix[][][][] array)
public static Polynomial[][][][] copy(Polynomial[][][][] array)
public static ComplexPoly[][][][] copy(ComplexPoly[][][][] array)
public static Phasor[][][][] copy(Phasor[][][][] array)
public static ErrorProp[][][][] copy(ErrorProp[][][][] array)
public static ComplexErrorProp[][][][] copy(ComplexErrorProp[][][][] array)
public static Double[][][][] copy(Double[][][][] array)
public static Float[][][][] copy(Float[][][][] array)
public static Long[][][][] copy(Long[][][][] array)
public static Integer[][][][] copy(Integer[][][][] array)
public static Short[][][][] copy(Short[][][][] array)
public static Byte[][][][] copy(Byte[][][][] array)
public static Character[][][][] copy(Character[][][][] array)




DEEP COPYING OF OBJECTS

See also
ArrayMaths, Complex, Point, VectorMaths, ArrayMaths, Matrix, ComplexMatrix, ComplexErrorProp, ComplexMatrix, ComplexPoly, ErrorProp, Matrix, Phasor, PhasorMatrix, BlackBox and all BlackBox subclasses for object specific deep copy methods.

Deep copying an Object
public static Object copy(Object obj)
public static Object copyObject(Object obj)
Usage:                      obj2 = Conv.copy(obj1);
A deep copy of the object, obj1, is returned as obj2 in the above usage.
An exception will be thrown if an attempt to copy a non-serialisable object is made. Included as required by other classes in this library. Adapted from Philip Isenhour's { Java Techniques } which should be consulted for a full discussion on copying objects.
The method copyObject(Object) is identical to copy(Object)

Deep copying of a one, two, three and four dimensional arrays
public static double[] copy(double[] array)
public static float[] copy(float[] array)
public static long[] copy(long[] array)
public static int[] copy(int[] array)
public static short[] copy(short[] array)
public static byte[] copy(byte[] array)
public static char[] copy(char[] array)
public static String[] copy(String[] array)
public static BigDecimal[] copy(BigDecimal[] array)
public static BigInteger[] copy(BigInteger[] array)
public static Complex[] copy(Complex[] array)
public static Point[] copy(Point[] array)
public static VectorMaths[] copy(VectorMaths[] array)
public static ArrayMaths[] copy(ArrayMaths[] array)
public static Matrix[] copy(Matrix[] array)
public static ComplexMatrix[] copy(PComplexMatrix[] array)
public static Polynomial[] copy(Polynomial[] array)
public static ComplexPoly[] copy(ComplexPoly[] array)
public static Phasor[] copy(Phasor[] array)
public static ErrorProp[] copy(ErrorProp[] array)
public static ComplexErrorProp[] copy(ComplexErrorProp[] array)
public static Double[] copy(Double[] array)
public static Float[] copy(Float[] array)
public static Long[] copy(Long[] array)
public static Integer[] copy(Integer[] array)
public static Short[] copy(Short[] array)
public static Byte[] copy(Byte[] array)
public static Character[] copy(Character[] array)

public static double[][] copy(double[][] array)
public static float[][] copy(float[][] array)
public static long[][] copy(long[][] array)
public static int[][] copy(int[][] array)
public static short[][] copy(short[][] array)
public static byte[][] copy(byte[][] array)
public static char[][] copy(char[][] array)
public static String[][] copy(String[][] array)
public static BigDecimal[][] copy(BigDecimal[][] array)
public static BigInteger[][] copy(BigInteger[][] array)
public static Complex[][] copy(Complex[][] array)
public static Point[][] copy(Point[][] array)
public static VectorMaths[][] copy(VectorMaths[][] array)
public static ArrayMaths[][] copy(ArrayMaths[][] array)
public static Matrix[][] copy(Matrix[][] array)
public static ComplexMatrix[][] copy(PComplexMatrix[][] array)
public static Polynomial[][] copy(Polynomial[][] array)
public static ComplexPoly[][] copy(ComplexPoly[][] array)
public static Phasor[][] copy(Phasor[][] array)
public static ErrorProp[][] copy(ErrorProp[][] array)
public static ComplexErrorProp[][] copy(ComplexErrorProp[][] array)
public static Double[][] copy(Double[][] array)
public static Float[][] copy(Float[][] array)
public static Long[][] copy(Long[][] array)
public static Integer[][] copy(Integer[][] array)
public static Short[][] copy(Short[][] array)
public static Byte[][] copy(Byte[][] array)
public static Character[][] copy(Character[][] array)

public static double[][][] copy(double[][][] array)
public static float[][][] copy(float[][][] array)
public static long[][][] copy(long[][][] array)
public static int[][][] copy(int[][][] array)
public static short[][][] copy(short[][][] array)
public static byte[][][] copy(byte[][][] array)
public static char[][][] copy(char[][][] array)
public static String[][][] copy(String[][][] array)
public static BigDecimal[][][] copy(BigDecimal[][][] array)
public static BigInteger[][][] copy(BigInteger[][][] array)
public static Complex[][][] copy(Complex[][][] array)
public static Point[][][] copy(Point[][][] array)
public static VectorMaths[][][] copy(VectorMaths[][][] array)
public static ArrayMaths[][][] copy(ArrayMaths[][][] array)
public static Matrix[][][] copy(Matrix[][][] array)
public static ComplexMatrix[][][] copy(PComplexMatrix[][][] array)
public static Polynomial[][][][] copy(Polynomial[][][] array)
public static ComplexPoly[][][] copy(ComplexPoly[][][] array)
public static Phasor[][][] copy(Phasor[][][] array)
public static ErrorProp[][][] copy(ErrorProp[][][] array)
public static ComplexErrorProp[][][] copy(ComplexErrorProp[][][] array)
public static Double[][][] copy(Double[][][] array)
public static Float[][][] copy(Float[][][] array)
public static Long[][][] copy(Long[][][] array)
public static Integer[][][] copy(Integer[][][] array)
public static Short[][][] copy(Short[][][] array)
public static Byte[][][] copy(Byte[][][] array)
public static Character[][][] copy(Character[][][] array)

public static double[][][][] copy(double[][][][] array)
public static float[][][][] copy(float[][][][] array)
public static long[][][][] copy(long[][][][] array)
public static int[][][][] copy(int[][][][] array)
public static short[][][][] copy(short[][][][] array)
public static byte[][][][] copy(byte[][][][] array)
public static char[][][][] copy(char[][][][] array)
public static String[][][][] copy(String[][][][] array)
public static BigDecimal[][][][] copy(BigDecimal[][][][] array)
public static BigInteger[][][][] copy(BigInteger[][][][] array)
public static Complex[][][][] copy(Complex[][][][] array)
public static Point[][][][] copy(Point[][][][] array)
public static VectorMaths[][][][] copy(VectorMaths[][][][] array)
public static ArrayMaths[][][][] copy(ArrayMaths[][][][] array)
public static Matrix[][][][] copy(Matrix[][][][] array)
public static ComplexMatrix[][][][] copy(PComplexMatrix[][][][] array)
public static Polynomial[][][][] copy(Polynomial[][][][] array)
public static ComplexPoly[][][][] copy(ComplexPoly[][][][]rray)
public static Phasor[][][][] copy(Phasor[][][][] array)
public static ErrorProp[][][][] copy(ErrorProp[][][][] array)
public static ComplexErrorProp[][][][] copy(ComplexErrorProp[][][][] array)
public static Double[][][][] copy(Double[][][][] array)
public static Float[][][][] copy(Float[][][][] array)
public static Long[][][][] copy(Long[][][][] array)
public static Integer[][][][] copy(Integer[][][][] array)
public static Short[][][][] copy(Short[][][][] array)
public static Byte[][][][] copy(Byte[][][][] array)
public static Character[][][][] copy(Character[][][][] array)

Usage:                      arrayCopy = Conv.copy(array);
Returns a deep copy [arrayCopy] of an array [array]. The array may be a one, two, three or four dimensional array and the elements of the array, which must be of identical type, may be of type double, float, int, long, short, byte, char, String, Double, Float, Long, Integer, Short or Byte, Character, BigDecimal, BigInteger, Complex, Point, VectorMaths, ArrayMaths, Matrix, ComplexMatrix, Polynomial, ComplexPoly, Phasor, ErrorProp or ComplexErrorProp.

OTHER CLASSES USED BY THIS CLASS

This class uses the following classes in this library:


This page was prepared by Dr Michael Thomas Flanagan