/** * */ package cortexrules; import java.awt.geom.GeneralPath; /** * add a new shape to a list of generalPaths * * @author John H. Krantz Ph.D * @version 0.1 * */ public class AddShape { // private routine to add a shape to a list public GeneralPath [] addShape(GeneralPath [] shapes, GeneralPath curShape){ if (curShape != null){ // only add if real shape if (shapes == null){ shapes= new GeneralPath [1]; shapes[0] = curShape; } else { GeneralPath hold [] = new GeneralPath[shapes.length]; // put current shapes in hold variable for (int i = 0; i < shapes.length; i ++) hold[i] = shapes[i]; shapes = new GeneralPath[hold.length+1]; // increase // length of array // return shapes for (int i = 0; i < hold.length; i ++) shapes[i] = hold[i]; shapes[shapes.length-1] = curShape; // add new shape } } return shapes; } }