0

I'm trying to figure the topic out. To begin, lets say I have different sets of points in a file with the following format:

2 //1st number represents number of points within set

3, 4 //following lines are points

5, 6

3

3, 4

5, 6

6, 2

..etc

I have figured out to perform a function on the first set, but I'm having a hard time figuring out how to loop a function with following sets.

Any help would be appreciated.

Here is my method for getting a set:

```
public static XYPoint [] readCoordinates(String fileName){
XYPoint points [] = null;
BufferedReader r;
double nPoints; //# of points
String nextline;
try{
InputStream is = new FileInputStream(fileName);
r = new BufferedReader(new InputStreamReader(is));
}
catch (IOException e){
System.out.println("IOException");
return points;
}
//get # of points
try{
nextline = r.readLine();
if (nextline == null){
System.out.println("Error");
return points;
}
nPoints = parseInteger(nextline);
}
catch (IOException e) {
System.out.println("IOException" +
fileName + "\n" + e);
return points;
}
points = new XYPoint [(int) nPoints];
//read in points
for (int j = 0; j < nPoints; j++){
try {
nextline = r.readLine();
if (nextline == null){
System.out.println("Error");
return points;
}
points[j] = parsePoint(nextline); //points here
} catch (IOException e) {
System.out.println("IOException");
return points;
}
}
return points;
}
}
```