8 package org.bitstorm.gameoflife;
10 import java.awt.Dimension;
11 import java.util.Enumeration;
27 public Shape( String name,
int[][] shape ) {
39 for (
int cell = 0; cell < shape.length; cell++) {
40 if (shape[cell][0] > shapeWidth)
41 shapeWidth = shape[cell][0];
42 if (shape[cell][1] > shapeHeight)
43 shapeHeight = shape[cell][1];
47 return new Dimension( shapeWidth, shapeHeight );
64 return new Enumeration() {
66 public boolean hasMoreElements() {
67 return index < shape.length;
69 public Object nextElement() {
70 return shape[index++];
79 return name+
" ("+shape.length+
" cell"+(shape.length==1?
"":
"s")+
")";
Shape(String name, int[][] shape)