int count = 0;
ArrayList pts = new ArrayList();
boolean moved = false;
boolean reasonToBePath = false;
Path path = null;
while (tokens.hasMoreTokens()) {
try {
String nextToken = tokens.nextToken();
if (nextToken.equals("L")) {
float x = Float.parseFloat(tokens.nextToken());
float y = Float.parseFloat(tokens.nextToken());
path.lineTo(x,y);
continue;
}
if (nextToken.equals("z")) {
path.close();
continue;
}
if (nextToken.equals("M")) {
if (!moved) {
moved = true;
float x = Float.parseFloat(tokens.nextToken());
float y = Float.parseFloat(tokens.nextToken());
path = new Path(x,y);
continue;
}
reasonToBePath = true;
float x = Float.parseFloat(tokens.nextToken());
float y = Float.parseFloat(tokens.nextToken());
path.startHole(x,y);
continue;
}
if (nextToken.equals("C")) {
reasonToBePath = true;
float cx1 = Float.parseFloat(tokens.nextToken());
float cy1 = Float.parseFloat(tokens.nextToken());
float cx2 = Float.parseFloat(tokens.nextToken());
float cy2 = Float.parseFloat(tokens.nextToken());
float x = Float.parseFloat(tokens.nextToken());
float y = Float.parseFloat(tokens.nextToken());
path.curveTo(x,y,cx1,cy1,cx2,cy2);
continue;
}
} catch (NumberFormatException e) {
throw new ParsingException(element.getAttribute("id"), "Invalid token in points list", e);
}