de.danielnaber.languagetool.rules
Class RuleMatch

Object
  extended by RuleMatch
All Implemented Interfaces:
Comparable<RuleMatch>

public class RuleMatch
extends Object
implements Comparable<RuleMatch>

A class that holds information about where a rule matches text.

Author:
Daniel Naber

Constructor Summary
RuleMatch(Rule rule, int fromPos, int toPos, String message)
           
RuleMatch(Rule rule, int fromPos, int toPos, String message, boolean startWithUppercase)
          Creates a RuleMatch object, taking the rule that triggered this match, position of the match and an explanation message.
 
Method Summary
 int compareTo(RuleMatch other)
           
 int getColumn()
          Get the column number in which the match occurs.
 int getEndColumn()
          Get the column number in which the match ends.
 int getEndLine()
          Get the line number in which the match ends.
 int getFromPos()
          Position of the start of the error (in characters).
 int getLine()
          Get the line number in which the match occurs.
 String getMessage()
          A short human-readable explanation describing the error.
 int getOffset()
          Get the character offset at which the match occurs.
 Rule getRule()
           
 List<String> getSuggestedReplacements()
          The text fragments which might be an appropriate fix for the problem.
 int getToPos()
          Position of the end of the error (in characters).
 void setColumn(int column)
          Set the column number in which the match occurs.
 void setEndColumn(int endColumn)
          Set the column number in which the match ends.
 void setEndLine(int endLine)
          Set the line number in which the match ends.
 void setLine(int fromLine)
          Set the line number in which the match occurs.
 void setOffset(int offset)
          Set the character offset at which the match occurs.
 void setSuggestedReplacement(String repl)
           
 void setSuggestedReplacements(List<String> repl)
           
 String toString()
           
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RuleMatch

public RuleMatch(Rule rule,
                 int fromPos,
                 int toPos,
                 String message)

RuleMatch

public RuleMatch(Rule rule,
                 int fromPos,
                 int toPos,
                 String message,
                 boolean startWithUppercase)
Creates a RuleMatch object, taking the rule that triggered this match, position of the match and an explanation message. This message is scanned for <suggestion>...</suggestion> to get suggested fixes for the problem detected by this rule.

Parameters:
startWithUppercase - whether the original text at the position of the match start with an uppercase character
Method Detail

getRule

public Rule getRule()

setLine

public void setLine(int fromLine)
Set the line number in which the match occurs.


getLine

public int getLine()
Get the line number in which the match occurs.


setEndLine

public void setEndLine(int endLine)
Set the line number in which the match ends.


getEndLine

public int getEndLine()
Get the line number in which the match ends.


setColumn

public void setColumn(int column)
Set the column number in which the match occurs.


getColumn

public int getColumn()
Get the column number in which the match occurs.


setEndColumn

public void setEndColumn(int endColumn)
Set the column number in which the match ends.


getEndColumn

public int getEndColumn()
Get the column number in which the match ends.


setOffset

public void setOffset(int offset)
Set the character offset at which the match occurs.


getOffset

public int getOffset()
Get the character offset at which the match occurs.


getFromPos

public int getFromPos()
Position of the start of the error (in characters).


getToPos

public int getToPos()
Position of the end of the error (in characters).


getMessage

public String getMessage()
A short human-readable explanation describing the error.


setSuggestedReplacement

public void setSuggestedReplacement(String repl)
See Also:
getSuggestedReplacements()

setSuggestedReplacements

public void setSuggestedReplacements(List<String> repl)
See Also:
getSuggestedReplacements()

getSuggestedReplacements

public List<String> getSuggestedReplacements()
The text fragments which might be an appropriate fix for the problem. One of these fragments can be used to replace the old text between getFromPos() to getToPos(). Text between <suggestion> and </suggestion> is taken as the suggested replacement.

Returns:
List of String objects or an empty List

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(RuleMatch other)
Specified by:
compareTo in interface Comparable<RuleMatch>


Copyright © 2005-2007 Daniel Naber