public int numPoints() { if ((subgeoms == null) || (subgeoms.length == 0)) { return 0; } else { int result = 0; for (int i = 0; i < subgeoms.length; i++) { result += subgeoms[i].numPoints(); } return result; } }
public int numPoints() { if ((subgeoms == null) || (subgeoms.length == 0)) { return 0; } else { int result = 0; for (int i = 0; i < subgeoms.length; i++) { result += subgeoms[i].numPoints(); } return result; } }
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!"); } }