Class DefaultParseResult
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult
-
- All Implemented Interfaces:
ParseResult
public class DefaultParseResult extends Object implements ParseResult
A basic implementation ofParseResult. Most, if not all,Parsers can return instances of this class.- See Also:
Parser
-
-
Constructor Summary
Constructors Constructor Description DefaultParseResult(Parser parser)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNotice(ParserNotice notice)Adds a parser notice.voidclearNotices()Clears any parser notices in this result.ExceptiongetError()Returns an error that occurred while parsing the document, if any.intgetFirstLineParsed()Returns the first line parsed.intgetLastLineParsed()Returns the first line parsed.List<ParserNotice>getNotices()Returns the notices for the parsed section.ParsergetParser()Returns the parser that generated these notices.longgetParseTime()Returns the amount of time this parser took to parse the specified range of text.voidsetError(Exception e)Sets the error that occurred when last parsing the document, if any.voidsetParsedLines(int first, int last)Sets the line range parsed.voidsetParseTime(long time)Sets the amount of time it took for this parser to parse the document.
-
-
-
Constructor Detail
-
DefaultParseResult
public DefaultParseResult(Parser parser)
-
-
Method Detail
-
addNotice
public void addNotice(ParserNotice notice)
Adds a parser notice.- Parameters:
notice- The new notice.- See Also:
clearNotices()
-
clearNotices
public void clearNotices()
Clears any parser notices in this result.- See Also:
addNotice(ParserNotice)
-
getError
public Exception getError()
Returns an error that occurred while parsing the document, if any.- Specified by:
getErrorin interfaceParseResult- Returns:
- The error, or
nullif the document was successfully parsed.
-
getFirstLineParsed
public int getFirstLineParsed()
Returns the first line parsed. All parser implementations should currently set this to0and parse the entire document.- Specified by:
getFirstLineParsedin interfaceParseResult- Returns:
- The first line parsed.
- See Also:
ParseResult.getLastLineParsed()
-
getLastLineParsed
public int getLastLineParsed()
Returns the first line parsed. All parser implementations should currently set this to the document's line count and parse the entire document.- Specified by:
getLastLineParsedin interfaceParseResult- Returns:
- The last line parsed.
- See Also:
ParseResult.getFirstLineParsed()
-
getNotices
public List<ParserNotice> getNotices()
Returns the notices for the parsed section.- Specified by:
getNoticesin interfaceParseResult- Returns:
- A list of
ParserNotices.
-
getParseTime
public long getParseTime()
Returns the amount of time this parser took to parse the specified range of text. This is an optional operation; parsers are permitted to return0for this value.- Specified by:
getParseTimein interfaceParseResult- Returns:
- The parse time, in milliseconds, or
0if the parse time was not recorded.
-
getParser
public Parser getParser()
Returns the parser that generated these notices.- Specified by:
getParserin interfaceParseResult- Returns:
- The parser.
-
setError
public void setError(Exception e)
Sets the error that occurred when last parsing the document, if any.- Parameters:
e- The error that occurred, ornullif no error occurred.
-
setParseTime
public void setParseTime(long time)
Sets the amount of time it took for this parser to parse the document.- Parameters:
time- The amount of time, in milliseconds.- See Also:
getParseTime()
-
setParsedLines
public void setParsedLines(int first, int last)Sets the line range parsed.- Parameters:
first- The first line parsed, inclusive.last- The last line parsed, inclusive.- See Also:
getFirstLineParsed(),getLastLineParsed()
-
-