de.danielnaber.languagetool.rules.patterns
Class AbstractPatternRule

Object
  extended by Rule
      extended by AbstractPatternRule
Direct Known Subclasses:
DisambiguationPatternRule, PatternRule

public abstract class AbstractPatternRule
extends Rule

An Abstract Pattern Rule that describes a pattern of words or part-of-speech tags used for PatternRule and DisambiguationPatternRule. Introduced to minimize code duplication between those classes.

Author:
Marcin MiƂkowski

Constructor Summary
AbstractPatternRule(String id, String description, Language language, List<Element> elements, boolean getUnified)
           
 
Method Summary
 String getDescription()
           
 String getId()
           
 RuleMatch[] match(AnalyzedSentence text)
          Check whether the given text matches this error rule, i.e. whether the text contains this error.
 void reset()
          If a rule keeps its state over more than the check of one sentence, this must be implemented so the internal state is reset.
 void setEndPositionCorrection(int endPositionCorrection)
           
 void setStartPositionCorrection(int startPositionCorrection)
           
 String toString()
           
 
Methods inherited from class Rule
addRuleMatch, clearMatches, getCategory, getCorrectExamples, getIncorrectExamples, getMatches, getMatchesIndex, isDefaultOff, isInMatches, isInRemoved, isParagraphBackTrack, setAsDeleted, setCategory, setCorrectExamples, setDefaultOff, setIncorrectExamples, setParagraphBackTrack, supportsLanguage
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPatternRule

public AbstractPatternRule(String id,
                           String description,
                           Language language,
                           List<Element> elements,
                           boolean getUnified)
Method Detail

toString

public final String toString()
Overrides:
toString in class Object

getDescription

public String getDescription()
Specified by:
getDescription in class Rule

getId

public String getId()
Specified by:
getId in class Rule

match

public RuleMatch[] match(AnalyzedSentence text)
                  throws IOException
Description copied from class: Rule
Check whether the given text matches this error rule, i.e. whether the text contains this error.

Specified by:
match in class Rule
Parameters:
text - a pre-analyzed sentence
Returns:
an array of RuleMatch object for each match.
Throws:
IOException

reset

public void reset()
Description copied from class: Rule
If a rule keeps its state over more than the check of one sentence, this must be implemented so the internal state is reset. It will be called before a new text is going to be checked.

Specified by:
reset in class Rule

setStartPositionCorrection

public final void setStartPositionCorrection(int startPositionCorrection)

setEndPositionCorrection

public final void setEndPositionCorrection(int endPositionCorrection)


Copyright © 2005-2009 Daniel Naber