Package org.nineml.coffeefilter
Class InvisibleXmlDocument
- java.lang.Object
-
- org.nineml.coffeefilter.InvisibleXmlDocument
-
- Direct Known Subclasses:
InvisibleXmlFailureDocument
public class InvisibleXmlDocument extends java.lang.ObjectAn InvisibleXmlDocument represents a document created with anInvisibleXmlParser.From this object, you can obtain the parsed representation(s) of the document. For ambiguous grammars, there may be more than one.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.nineml.coffeegrinder.trees.TreeBuildergetAdapter(org.xml.sax.ContentHandler handler)Returns an adapter for SAX ContentHandlers.intgetColumnNumber()Get the column number of the last line processed.intgetLineNumber()Get the line number of the last line processed.longgetNumberOfParses()Return the number of available parses of this document.intgetOffset()Get the offset of the last character processed.ParserOptionsgetOptions()Get the parser options.org.nineml.coffeegrinder.parser.ParserTypegetParserType()Return the parser type.java.lang.StringgetParserVersion()Get the parser version.org.nineml.coffeegrinder.parser.GearleyResultgetResult()Return the underlyingGearleyResultresult for this parse.java.lang.StringgetTree()Return an XML representation of the current parse.voidgetTree(java.io.PrintStream output)Write an XML representation of the current parse to the stream.voidgetTree(org.nineml.coffeegrinder.trees.TreeBuilder builder)Process the result with your ownTreeBuilder.voidgetTree(org.xml.sax.ContentHandler handler)Write an XML representation of the current parse to a SAX ContentHandler.voidgetTree(org.xml.sax.ContentHandler handler, ParserOptions options)Write an XML representation of the current parse to a SAX ContentHandler using a different set of options.booleanisAmbiguous()Is this document ambiguous?booleanisInfinitelyAmbiguous()Is this document infinitely ambiguous?longparseTime()Returns the amount of time (roughly) spent parsing.booleansucceeded()Did the parse succeed?
-
-
-
Method Detail
-
getParserVersion
public java.lang.String getParserVersion()
Get the parser version.- Returns:
- the parser version
-
getOptions
public ParserOptions getOptions()
Get the parser options.- Returns:
- the parser options
-
getLineNumber
public int getLineNumber()
Get the line number of the last line processed.If the parse failed, this will be the line on which the error occurred. Lines are counted by occurrence of '\n'.
- Returns:
- the line number
-
getColumnNumber
public int getColumnNumber()
Get the column number of the last line processed.If the parse failed, this will be the position of the character in the last line where the error occurred.
- Returns:
- the column number
-
getOffset
public int getOffset()
Get the offset of the last character processed.If the parse failed, this will be the position of the character in the input stream.
- Returns:
- the offset
-
getResult
public org.nineml.coffeegrinder.parser.GearleyResult getResult()
Return the underlyingGearleyResultresult for this parse.- Returns:
- the result
-
getParserType
public org.nineml.coffeegrinder.parser.ParserType getParserType()
Return the parser type.- Returns:
- the parser type
-
succeeded
public boolean succeeded()
Did the parse succeed?- Returns:
- true if the parse was successful
-
getNumberOfParses
public long getNumberOfParses()
Return the number of available parses of this document.Will return 0 if there are no successful parses.
- Returns:
- The number of parses.
-
isAmbiguous
public boolean isAmbiguous()
Is this document ambiguous?The return value is arbitrary if the parse did not succeed.
- Returns:
- true, if the document is ambiguous
-
isInfinitelyAmbiguous
public boolean isInfinitelyAmbiguous()
Is this document infinitely ambiguous?The return value is arbitrary if the parse did not succeed.
- Returns:
- true, if the document is ambiguous
-
parseTime
public long parseTime()
Returns the amount of time (roughly) spent parsing.- Returns:
- The number of milliseconds spent parsing.
-
getAdapter
public org.nineml.coffeegrinder.trees.TreeBuilder getAdapter(org.xml.sax.ContentHandler handler)
Returns an adapter for SAX ContentHandlers.- Parameters:
handler- the content handler- Returns:
- an adapting tree builder
-
getTree
public java.lang.String getTree()
Return an XML representation of the current parse.- Returns:
- the XML.
- Throws:
IxmlException- if the parse failed
-
getTree
public void getTree(java.io.PrintStream output)
Write an XML representation of the current parse to the stream.- Parameters:
output- the output stream.
-
getTree
public void getTree(org.xml.sax.ContentHandler handler)
Write an XML representation of the current parse to a SAX ContentHandler.- Parameters:
handler- the content handler.
-
getTree
public void getTree(org.xml.sax.ContentHandler handler, ParserOptions options)Write an XML representation of the current parse to a SAX ContentHandler using a different set of options.- Parameters:
handler- the content handler.options- the options.
-
getTree
public void getTree(org.nineml.coffeegrinder.trees.TreeBuilder builder)
Process the result with your ownTreeBuilder.This API needs work.
- Parameters:
builder- the tree builder.
-
-