index = parsePolygon(wktGeometry, st, index + 1, true);
index = parseRing(wktGeometry, st, index + 1, true);
	private int parseGeometry(String wktGeometry, StringTokenizer st, int index)		throws MapyrusException	{		String token;		String ogcType;		boolean foundOpenParen, foundCloseParen, foundComma, foundEmptyList;		if (st.hasMoreTokens())		{			/*			 * Find geometry type, skipping any leading spaces.			 */			ogcType = st.nextToken();			while (ogcType.equals(" ") && st.hasMoreTokens())				ogcType = st.nextToken();			/*			 * What type of geometry is this?			 */			if (ogcType.equals("POINT"))			{				mGeometryValue[index] = GEOMETRY_POINT;				index = parseCoordinateList(wktGeometry, st, index + 1, false);			}			else if (ogcType.equals("LINESTRING"))			{				mGeometryValue[index] = GEOMETRY_LINESTRING;					index = parseCoordinateList(wktGeometry, st, index + 1, false);			}			else if (ogcType.equals("MULTIPOINT"))			{				mGeometryValue[index] = GEOMETRY_MULTIPOINT;				index = parseCoordinateList(wktGeometry, st, index + 1, true);			}			else			{				if (ogcType.equals("POLYGON"))					mGeometryValue[index] = GEOMETRY_POLYGON;				else if (ogcType.equals("MULTILINESTRING"))					mGeometryValue[index] = GEOMETRY_MULTILINESTRING;				else if (ogcType.equals("MULTIPOLYGON"))					mGeometryValue[index] = GEOMETRY_MULTIPOLYGON;				else if (ogcType.equals("GEOMETRYCOLLECTION"))					mGeometryValue[index] = GEOMETRY_COLLECTION;				else				{					throw new MapyrusException(MapyrusMessages.get(MapyrusMessages.INVALID_OGC_WKT) +						": " + wktGeometry);				}				if (mGeometryValue[index] == GEOMETRY_POLYGON)				{					index = parsePolygon(wktGeometry, st, index + 1, false);				}				else if (mGeometryValue[index] == GEOMETRY_MULTILINESTRING)				{					index = parsePolygon(wktGeometry, st, index + 1, true);				}				else				{					/*					 * Parse any number of polygons or geometries surrounded					 * by parentheses.					 */					foundOpenParen = foundCloseParen = foundEmptyList = false;					while (foundOpenParen == false && foundEmptyList == false && st.hasMoreTokens())					{						token = st.nextToken();						foundOpenParen = token.equals("(");						foundEmptyList = token.equals("EMPTY");					}					int geometryType = (int)mGeometryValue[index];					int counter = 0;					int counterIndex = index + 1;					index += 2;					while (foundOpenParen && foundCloseParen == false && st.hasMoreTokens())					{						if (geometryType == GEOMETRY_MULTIPOLYGON)						{							mGeometryValue[index] = GEOMETRY_POLYGON;							index = parsePolygon(wktGeometry, st, index + 1, false);						}						else						{							index = parseGeometry(wktGeometry, st, index);						}						counter++;						foundComma = false;						while (foundComma == false &&							foundCloseParen == false && st.hasMoreTokens())						{							token = st.nextToken();							if (token.equals(","))								foundComma = true;							else if (token.equals(")"))								foundCloseParen = true;						}					}					/*					 * Set number of sub-geometries in MULTIPOLYGON or GEOMETRYCOLLECTION. 					 */					mGeometryValue[counterIndex] = counter;					if (foundOpenParen && foundCloseParen == false)					{						throw new MapyrusException(MapyrusMessages.get(MapyrusMessages.INVALID_OGC_WKT) +							": " + wktGeometry);					}				}			}		}		else		{			throw new MapyrusException(MapyrusMessages.get(MapyrusMessages.INVALID_OGC_WKT) +				": " + wktGeometry);		}		return(index);	}