/** * */ package cortexrules; import java.awt.geom.*; /** * add a new point to a list of points * * @author John H. Krantz Ph.D * @version 0.1 * */ public class AddPoint { // private routine to add a shape to a list public Point2D [] addPoint(Point2D [] points, Point2D curPoint){ if (curPoint != null){ // only add if real shape if (points == null){ points = new Point2D.Double [1]; points[0] = curPoint; } else { Point2D hold [] = new Point2D[points.length]; // put current shapes in hold variable for (int i = 0; i < points.length; i ++) hold[i] = points[i]; points = new Point2D[hold.length+1]; // increase // length of array // return shapes for (int i = 0; i < hold.length; i ++) points[i] = hold[i]; points[points.length-1] = curPoint; // add new shape } } return points; } /** * returns points in an ordered array * need order rule * @param Point2D [] points array of points to order * @return Points2D [] the ordered array. */ /* public Point2D [] orderPoint(Point2D [] points){ return points; } */ }