org.fife.ui.rsyntaxtextarea.parser

## Class DefaultParserNotice

- java.lang.Object
- - org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice

All Implemented Interfaces:
  Comparable<ParserNotice>, ParserNotice

Direct Known Subclasses:
  TaskTagParser.TaskNotice

    public class DefaultParserNotice
    extends Object
    implements ParserNotice

Base implementation of a parser notice. Most `Parser` implementations can return instances of this in their parse result.

Version:
  1.0
Author:
  Robert Futrell
See Also:
  `Parser`, `ParseResult`

### Field Summary

### Fields inherited from interface org.fife.ui.rsyntaxtextarea.parser.ParserNotice

`ERROR, INFO, WARNING`

### Constructor Summary

Constructors
Constructor and Description
`DefaultParserNotice(Parser parser, String msg, int line)` Constructor.
`DefaultParserNotice(Parser parser, String message, int line, int offset, int length)` Constructor.

### Method Summary

Methods
`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.
`int` `getLength()` Returns the length of the code the message is concerned with.
`int` `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 tooltip 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(int 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 tooltip text to display for this notice.
`String` `toString()` Returns a string representation of this parser notice.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### DefaultParserNotice

    public DefaultParserNotice(Parser parser,
                       String msg,
                       int line)

Constructor.

Parameters:
  `parser` - The parser that created this notice.
  `msg` - The text of the message.
  `line` - The line number for the message.

#### DefaultParserNotice

    public DefaultParserNotice(Parser parser,
                       String message,
                       int line,
                       int offset,
                       int length)

Constructor.

Parameters:
  `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.

### Method Detail

#### compareTo

    public int compareTo(ParserNotice other)

Compares this parser notice to another.

Specified by:
  `compareTo` in interface `Comparable<ParserNotice>`
Parameters:
  `other` - Another parser notice.
Returns:
  How the two parser notices should be sorted relative to one another.

#### containsPosition

    public boolean containsPosition(int pos)

Returns whether this parser notice contains the specified location in the document.

Specified by:
  `containsPosition` in interface `ParserNotice`
Parameters:
  `pos` - The position in the document.
Returns:
  Whether the position is contained. This will always return `false` if `ParserNotice.getOffset()` returns `-1`.

#### equals

    public boolean equals(Object obj)

Returns whether this parser notice is equal to another one.

Overrides:
  `equals` in class `Object`
Parameters:
  `obj` - Another parser notice.
Returns:
  Whether the two notices are equal.

#### getColor

    public Color getColor()

Returns the color to use when painting this notice.

Specified by:
  `getColor` in interface `ParserNotice`
Returns:
  The color.

#### getLength

    public int getLength()

Returns the length of the code the message is concerned with.

Specified by:
  `getLength` in interface `ParserNotice`
Returns:
  The length of the code the message is concerned with, or `-1` if unknown.
See Also:
  `ParserNotice.getOffset()`, `ParserNotice.getLine()`

#### getLevel

    public int getLevel()

Returns the level of this notice.

Specified by:
  `getLevel` in interface `ParserNotice`
Returns:
  One of `ParserNotice.INFO`, `ParserNotice.WARNING` OR `ParserNotice.ERROR`.

#### getLine

    public int getLine()

Returns the line number the notice is about.

Specified by:
  `getLine` in interface `ParserNotice`
Returns:
  The line number.

#### getMessage

    public String getMessage()

Returns the message from the parser.

Specified by:
  `getMessage` in interface `ParserNotice`
Returns:
  The message from the parser.

#### getOffset

    public int getOffset()

Returns the offset of the code the message is concerned with.

Specified by:
  `getOffset` in interface `ParserNotice`
Returns:
  The offset, or `-1` if unknown.
See Also:
  `ParserNotice.getLength()`, `ParserNotice.getLine()`

#### getParser

    public Parser getParser()

Returns the parser that created this message.

Specified by:
  `getParser` in interface `ParserNotice`
Returns:
  The parser.

#### getShowInEditor

    public boolean getShowInEditor()

Whether a squiggle underline should be drawn in the editor for this notice.

Specified by:
  `getShowInEditor` in interface `ParserNotice`
Returns:
  Whether a squiggle underline should be drawn.

#### getToolTipText

    public String getToolTipText()

Returns the tooltip text to display for this notice.

Specified by:
  `getToolTipText` in interface `ParserNotice`
Returns:
  The tool tip text. If none has been explicitly set, this method returns the same text as `ParserNotice.getMessage()`.

#### hashCode

    public int hashCode()

Returns the hash code for this notice.

Overrides:
  `hashCode` in class `Object`
Returns:
  The hash code.

#### setColor

    public void setColor(Color color)

Sets the color to use when painting this notice.

Parameters:
  `color` - The color to use.
See Also:
  `getColor()`

#### setLevel

    public void setLevel(int level)

Sets the level of this notice.

Parameters:
  `level` - The new level.
See Also:
  `getLevel()`

#### setShowInEditor

    public void setShowInEditor(boolean show)

Sets whether a squiggle underline should be drawn in the editor for this notice.

Parameters:
  `show` - Whether to draw a squiggle underline.
See Also:
  `getShowInEditor()`

#### setToolTipText

    public void setToolTipText(String text)

Sets the tooltip text to display for this notice.

Parameters:
  `text` - The new tooltip text. This can be HTML. If this is `null`, then tooltips will return the same text as `getMessage()`.
See Also:
  `getToolTipText()`

#### toString

    public String toString()

Returns a string representation of this parser notice.

Overrides:
  `toString` in class `Object`
Returns:
  This parser notice as a string.