text: public SpatialArgs parse(String v, SpatialContext ctx) throws ParseException, InvalidShapeException {int idx = v.indexOf('(');int edx = v.lastIndexOf(')');if (idx < 0 || idx > edx) {throw new ParseException("missing parens: " + v, -1);}SpatialOperation op = SpatialOperation.get(v.substring(0, idx).trim());String body = v.substring(idx + 1, edx).trim();if (body.length() < 1) {throw new ParseException("missing body : " + v, idx + 1);}Shape shape = parseShape(body, ctx);SpatialArgs args = newSpatialArgs(op, shape);if (v.length() > (edx + 1)) {body = v.substring(edx + 1).trim();if (body.length() > 0) {Map<String, String> aa = parseMap(body);readNameValuePairs(args, aa);if (!aa.isEmpty()) {throw new IllegalArgumentException("unused parameters: " + aa);}}}args.validate();return args;}