Пример #1
0
 // Clone a PhasorMatrix
 public Object clone() {
   if (this == null) {
     return null;
   } else {
     int nr = this.nrow;
     int nc = this.ncol;
     PhasorMatrix b = new PhasorMatrix(nr, nc);
     Phasor[][] barray = b.getArrayReference();
     b.nrow = nr;
     b.ncol = nc;
     for (int i = 0; i < nr; i++) {
       for (int j = 0; j < nc; j++) {
         barray[i][j] = Phasor.copy(this.matrix[i][j]);
       }
     }
     for (int i = 0; i < nr; i++) b.index[i] = this.index[i];
     return (Object) b;
   }
 }
Пример #2
0
 // COPY
 // Copy a PhasorMatrix [static method]
 public static PhasorMatrix copy(PhasorMatrix a) {
   if (a == null) {
     return null;
   } else {
     int nr = a.getNrow();
     int nc = a.getNcol();
     Phasor[][] aarray = a.getArrayReference();
     PhasorMatrix b = new PhasorMatrix(nr, nc);
     b.nrow = nr;
     b.ncol = nc;
     Phasor[][] barray = b.getArrayReference();
     for (int i = 0; i < nr; i++) {
       for (int j = 0; j < nc; j++) {
         barray[i][j] = Phasor.copy(aarray[i][j]);
       }
     }
     for (int i = 0; i < nr; i++) b.index[i] = a.index[i];
     return b;
   }
 }