public Point getPoint(int n) { if (n < 0) { throw new ArrayIndexOutOfBoundsException("Negative index not allowed"); } else if ((subgeoms == null) || (subgeoms.length == 0)) { throw new ArrayIndexOutOfBoundsException("Empty Geometry has no Points!"); } else { for (int i = 0; i < subgeoms.length; i++) { Geometry current = subgeoms[i]; int np = current.numPoints(); if (n < np) { return current.getPoint(n); } else { n -= np; } } throw new ArrayIndexOutOfBoundsException("Index too large!"); } }
public Point getPoint(int n) { if (n < 0) { throw new ArrayIndexOutOfBoundsException("Negative index not allowed"); } else if ((subgeoms == null) || (subgeoms.length == 0)) { throw new ArrayIndexOutOfBoundsException("Empty Geometry has no Points!"); } else { for (int i = 0; i < subgeoms.length; i++) { Geometry current = subgeoms[i]; int np = current.numPoints(); if (n < np) { return current.getPoint(n); } else { n -= np; } } throw new ArrayIndexOutOfBoundsException("Index too large!"); } }