|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectElement
public final class Element
An element in a Well Know Text (WKT). A Element
is
made of String
, Number
and other Element
. For example:
EachPRIMEM["Greenwich", 0.0, AUTHORITY["some authority", "Greenwich"]]
Element
object can contains an arbitrary amount of other elements.
The result is a tree, which can be printed with print(java.io.PrintWriter, int)
.
Elements can be pull in a first in, first out order.
Field Summary | |
---|---|
String |
keyword
Keyword of this entity. |
Method Summary | |
---|---|
void |
close()
Close this element. |
boolean |
isRoot()
Returns true if this element is the root element. |
ParseException |
parseFailed(Exception cause,
String message)
Returns a ParseException with the specified cause. |
Object |
peek()
Returns the next element, or null if there is no more
element. |
void |
print(PrintWriter out,
int level)
Print this Element as a tree. |
double |
pullDouble(String key)
Removes the next Number from the list and returns it. |
Element |
pullElement(String key)
Removes the next Element from the list and returns it. |
int |
pullInteger(String key)
Removes the next Number from the list and returns it
as an integer. |
Element |
pullOptionalElement(String key)
Removes the next Element from the list and returns it. |
String |
pullString(String key)
Removes the next String from the list and returns it. |
Element |
pullVoidElement(String key)
Removes and returns the next Element with no bracket. |
String |
toString()
Returns the keyword. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final String keyword
Method Detail |
---|
public ParseException parseFailed(Exception cause, String message)
ParseException
with the specified cause. A localized string
"Error in <keyword
>"
will be prepend to the message.
The error index will be the starting index of this Element
.
cause
- The cause of the failure, or null
if none.message
- The message explaining the cause of the failure, or null
for reusing the same message than cause
.
public boolean isRoot()
true
if this element is the root element. For example in a WKT like
"GEOGCS["name", DATUM["name, ...]]"
, this is true for "GEOGCS"
and
false for all other elements inside, like "DATUM"
.
true
if this element is the root element.public double pullDouble(String key) throws ParseException
Number
from the list and returns it.
key
- The parameter name. Used for formatting
an error message if no number are found.
Number
on the list as a double
.
ParseException
- if no more number is available.public int pullInteger(String key) throws ParseException
Number
from the list and returns it
as an integer.
key
- The parameter name. Used for formatting
an error message if no number are found.
Number
on the list as an int
.
ParseException
- if no more number is available, or the number
is not an integer.public String pullString(String key) throws ParseException
String
from the list and returns it.
key
- The parameter name. Used for formatting
an error message if no number are found.
String
on the list.
ParseException
- if no more string is available.public Element pullElement(String key) throws ParseException
Element
from the list and returns it.
key
- The element name (e.g. "PRIMEM"
).
Element
on the list.
ParseException
- if no more element is available.public Element pullOptionalElement(String key)
Element
from the list and returns it.
key
- The element name (e.g. "PRIMEM"
).
Element
on the list,
or null
if no more element is available.public Element pullVoidElement(String key) throws ParseException
Element
with no bracket.
The key is used only for only for formatting an error message.
key
- The parameter name. Used only for formatting an error message.
Element
in the list, with no bracket.
ParseException
- if no more void element is available.public Object peek()
null
if there is no more
element. The element is not removed from the list.
null
if there is no more elements.public void close() throws ParseException
ParseException
- If the list still contains some unprocessed elements.public String toString()
close()
.
toString
in class Object
public void print(PrintWriter out, int level)
Element
as a tree.
This method is used for debugging purpose only.
out
- The output stream.level
- The indentation level (usually 0).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |