package mygraphs; public class PlotPath { int numPoints = 0; float [] xPts = new float[100]; float [] yPts = new float[100]; public PlotPath() {} public final void addPoint(float x, float y) { if(numPoints == xPts.length) { float [] temp_xpts = new float[numPoints + 100]; float [] temp_ypts = new float[numPoints + 100]; System.arraycopy(xPts, 0, temp_xpts, 0, numPoints); System.arraycopy(yPts, 0, temp_ypts, 0, numPoints); xPts = temp_xpts; yPts = temp_ypts; } xPts[numPoints] = x; yPts[numPoints] = y; numPoints++; } public int getNumPoints() { return numPoints; } public float getX(int pt) { return xPts[pt]; } public float getY(int pt) { return yPts[pt]; } }