/** * Returns the next word in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be a word. *@return the next word in the stream as uppercase text *@throws ParseException if the next token is not a word *@throws IOException if an I/O error occurs */ private String getNextWord() throws IOException, ParseException { int type = tokenizer.nextToken(); switch (type) { case StreamTokenizer.TT_WORD: String word = tokenizer.sval; if (word.equalsIgnoreCase(EMPTY)) return EMPTY; return word; case '(': return L_PAREN; case ')': return R_PAREN; case ',': return COMMA; } parseErrorExpected("word"); return null; }
/** * Returns the next R_PAREN or COMMA in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be R_PAREN or COMMA. *@return the next R_PAREN or COMMA in the stream *@throws ParseException if the next token is not R_PAREN or COMMA *@throws IOException if an I/O error occurs */ private String getNextCloserOrComma() throws IOException, ParseException { String nextWord = getNextWord(); if (nextWord.equals(COMMA) || nextWord.equals(R_PAREN)) { return nextWord; } parseErrorExpected(COMMA + " or " + R_PAREN); return null; }
/** * Returns the next R_PAREN in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be R_PAREN. *@return the next R_PAREN in the stream *@throws ParseException if the next token is not R_PAREN *@throws IOException if an I/O error occurs */ private String getNextCloser() throws IOException, ParseException { String nextWord = getNextWord(); if (nextWord.equals(R_PAREN)) { return nextWord; } parseErrorExpected(R_PAREN); return null; }
/** * Returns the next EMPTY or L_PAREN in the stream as uppercase text. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be EMPTY or L_PAREN. *@return the next EMPTY or L_PAREN in the stream as uppercase * text. *@throws ParseException if the next token is not EMPTY or L_PAREN *@throws IOException if an I/O error occurs */ private String getNextEmptyOrOpener() throws IOException, ParseException { String nextWord = getNextWord(); if (nextWord.equals(EMPTY) || nextWord.equals(L_PAREN)) { return nextWord; } parseErrorExpected(EMPTY + " or " + L_PAREN); return null; }
parseErrorExpected("number"); return 0.0;
/** * Returns the next word in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be a word. *@return the next word in the stream as uppercase text *@throws ParseException if the next token is not a word *@throws IOException if an I/O error occurs */ private String getNextWord() throws IOException, ParseException { int type = tokenizer.nextToken(); switch (type) { case StreamTokenizer.TT_WORD: String word = tokenizer.sval; if (word.equalsIgnoreCase(EMPTY)) return EMPTY; return word; case '(': return L_PAREN; case ')': return R_PAREN; case ',': return COMMA; } parseErrorExpected("word"); return null; }
/** * Returns the next R_PAREN or COMMA in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be R_PAREN or COMMA. *@return the next R_PAREN or COMMA in the stream *@throws ParseException if the next token is not R_PAREN or COMMA *@throws IOException if an I/O error occurs */ private String getNextCloserOrComma() throws IOException, ParseException { String nextWord = getNextWord(); if (nextWord.equals(COMMA) || nextWord.equals(R_PAREN)) { return nextWord; } parseErrorExpected(COMMA + " or " + R_PAREN); return null; }
/** * Returns the next R_PAREN in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be R_PAREN. *@return the next R_PAREN in the stream *@throws ParseException if the next token is not R_PAREN *@throws IOException if an I/O error occurs */ private String getNextCloser() throws IOException, ParseException { String nextWord = getNextWord(); if (nextWord.equals(R_PAREN)) { return nextWord; } parseErrorExpected(R_PAREN); return null; }
/** * Returns the next EMPTY or L_PAREN in the stream as uppercase text. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be EMPTY or L_PAREN. *@return the next EMPTY or L_PAREN in the stream as uppercase * text. *@throws ParseException if the next token is not EMPTY or L_PAREN *@throws IOException if an I/O error occurs */ private String getNextEmptyOrOpener() throws IOException, ParseException { String nextWord = getNextWord(); if (nextWord.equals(EMPTY) || nextWord.equals(L_PAREN)) { return nextWord; } parseErrorExpected(EMPTY + " or " + L_PAREN); return null; }
parseErrorExpected("number"); return 0.0;