public class DefaultParserNotice extends Object implements ParserNotice
Parser
implementations can return instances of this in their parse result.Parser
,
ParseResult
ParserNotice.Level
Constructor and Description |
---|
DefaultParserNotice(Parser parser,
String msg,
int line)
Constructor.
|
DefaultParserNotice(Parser parser,
String message,
int line,
int offset,
int length)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ParserNotice other)
Compares this parser notice to another.
|
boolean |
containsPosition(int pos)
Returns whether this parser notice contains the specified location
in the document.
|
boolean |
equals(Object obj)
Returns whether this parser notice is equal to another one.
|
Color |
getColor()
Returns the color to use when painting this notice.
|
boolean |
getKnowsOffsetAndLength()
Returns whether this parser notice has offset and length information
(as opposed to just what line number to mark).
|
int |
getLength()
Returns the length of the code the message is concerned with.
|
ParserNotice.Level |
getLevel()
Returns the level of this notice.
|
int |
getLine()
Returns the line number the notice is about.
|
String |
getMessage()
Returns the message from the parser.
|
int |
getOffset()
Returns the offset of the code the message is concerned with.
|
Parser |
getParser()
Returns the parser that created this message.
|
boolean |
getShowInEditor()
Whether a squiggle underline should be drawn in the editor for this
notice.
|
String |
getToolTipText()
Returns the tool tip text to display for this notice.
|
int |
hashCode()
Returns the hash code for this notice.
|
void |
setColor(Color color)
Sets the color to use when painting this notice.
|
void |
setLevel(ParserNotice.Level level)
Sets the level of this notice.
|
void |
setShowInEditor(boolean show)
Sets whether a squiggle underline should be drawn in the editor for
this notice.
|
void |
setToolTipText(String text)
Sets the tool tip text to display for this notice.
|
String |
toString()
Returns a string representation of this parser notice.
|
public DefaultParserNotice(Parser parser, String msg, int line)
parser
- The parser that created this notice.msg
- The text of the message.line
- The line number for the message.public DefaultParserNotice(Parser parser, String message, int line, int offset, int length)
parser
- The parser that created this notice.message
- The message.line
- The line number corresponding to the message.offset
- The offset in the input stream of the code the
message is concerned with, or -1
if unknown.length
- The length of the code the message is concerned with,
or -1
if unknown.public int compareTo(ParserNotice other)
compareTo
in interface Comparable<ParserNotice>
other
- Another parser notice.public boolean containsPosition(int pos)
containsPosition
in interface ParserNotice
pos
- The position in the document.false
if ParserNotice.getOffset()
returns
-1
.public boolean equals(Object obj)
public Color getColor()
getColor
in interface ParserNotice
public boolean getKnowsOffsetAndLength()
getKnowsOffsetAndLength
in interface ParserNotice
ParserNotice.getLine()
,
ParserNotice.getOffset()
,
ParserNotice.getLength()
public int getLength()
getLength
in interface ParserNotice
-1
if unknown.ParserNotice.getOffset()
,
ParserNotice.getLine()
public ParserNotice.Level getLevel()
getLevel
in interface ParserNotice
ParserNotice.Level
enumeration.public int getLine()
getLine
in interface ParserNotice
public String getMessage()
getMessage
in interface ParserNotice
public int getOffset()
getOffset
in interface ParserNotice
-1
if unknown.ParserNotice.getLength()
,
ParserNotice.getLine()
public Parser getParser()
getParser
in interface ParserNotice
public boolean getShowInEditor()
getShowInEditor
in interface ParserNotice
public String getToolTipText()
getToolTipText
in interface ParserNotice
ParserNotice.getMessage()
.public int hashCode()
public void setColor(Color color)
color
- The color to use.getColor()
public void setLevel(ParserNotice.Level level)
level
- The new level.getLevel()
public void setShowInEditor(boolean show)
show
- Whether to draw a squiggle underline.getShowInEditor()
public void setToolTipText(String text)
text
- The new tool tip text. This can be HTML. If this is
null
, then tool tips will return the same text as
getMessage()
.getToolTipText()
Copyright © 2003–2015. All rights reserved.