| 268 | { private Shape[][][] shapes = new Shape[10][10][]; |
| 269 | |
| 270 | @SuppressWarnings("unchecked") |
| 271 | private Piece (Shape[] list) |
| 272 | { // ... initialise |
| 273 | |
| 274 | ArrayList[][] array = new ArrayList[10][10]; |
| 275 | |
| 276 | for (int i=0; i<10; i++) |
| 277 | for (int j=0; j<10; j++) |
| 278 | array[i][j] = new ArrayList<Shape>(); |
| 279 | |
| 280 | // ... generate list |
| 281 | |
| 282 | for (Shape mutant: list) |
| 283 | for (int row=0; row<=mutant.maxRow; row++) |
| 284 | for (int col=mutant.minCol; col<=mutant.maxCol; col++) |
| 285 | { if (!mutant.islet) |
| 286 | array[row][col].add(new Shape(mutant,row,col)); |
| 287 | else if ((row != 0) || (col != 0)) |
| 288 | array[row][col].add(new Shape(mutant,row,col)); |
| 289 | } |
| 290 | |
| 291 | for (int row=0; row<10; row++) |
| 292 | for (int col=0; col<10; col++) |
| 293 | shapes[row][col] = (Shape[]) array[row][col].toArray(new Shape[0]); |
| 294 | } |
| 295 | |
| 296 | @SuppressWarnings("unchecked") |
| 297 | private Shape[] shapes(int row,int col) |