public class DefaultParserNotice extends java.lang.Object implements ParserNotice
Parser
implementations can return instances of this in their parse result.Parser
,
ParseResult
ParserNotice.Level
Constructor and Description |
---|
DefaultParserNotice(Parser parser,
java.lang.String msg,
int line)
Constructor.
|
DefaultParserNotice(Parser parser,
java.lang.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(java.lang.Object obj)
Returns whether this parser notice is equal to another one.
|
java.awt.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.
|
java.lang.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.
|
java.lang.String |
getToolTipText()
Returns the tool tip text to display for this notice.
|
int |
hashCode()
Returns the hash code for this notice.
|
void |
setColor(java.awt.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(java.lang.String text)
Sets the tool tip text to display for this notice.
|
java.lang.String |
toString()
Returns a string representation of this parser notice.
|
public DefaultParserNotice(Parser parser, java.lang.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, java.lang.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 java.lang.Comparable<ParserNotice>
other
- Another parser notice.public boolean containsPosition(int pos)
ParserNotice
containsPosition
in interface ParserNotice
pos
- The position in the document.false
if ParserNotice.getOffset()
returns
-1
.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Another parser notice.public java.awt.Color getColor()
ParserNotice
getColor
in interface ParserNotice
public boolean getKnowsOffsetAndLength()
ParserNotice
getKnowsOffsetAndLength
in interface ParserNotice
ParserNotice.getLine()
,
ParserNotice.getOffset()
,
ParserNotice.getLength()
public int getLength()
ParserNotice
getLength
in interface ParserNotice
-1
if unknown.ParserNotice.getOffset()
,
ParserNotice.getLine()
public ParserNotice.Level getLevel()
ParserNotice
getLevel
in interface ParserNotice
ParserNotice.Level
enumeration.public int getLine()
ParserNotice
getLine
in interface ParserNotice
public java.lang.String getMessage()
ParserNotice
getMessage
in interface ParserNotice
public int getOffset()
ParserNotice
getOffset
in interface ParserNotice
-1
if unknown.ParserNotice.getLength()
,
ParserNotice.getLine()
public Parser getParser()
ParserNotice
getParser
in interface ParserNotice
public boolean getShowInEditor()
ParserNotice
getShowInEditor
in interface ParserNotice
public java.lang.String getToolTipText()
ParserNotice
getToolTipText
in interface ParserNotice
ParserNotice.getMessage()
.public int hashCode()
hashCode
in class java.lang.Object
public void setColor(java.awt.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(java.lang.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()
public java.lang.String toString()
toString
in class java.lang.Object