class SentenceWithModalVerbRule extends AbstractStatisticSentenceStyleRule {
  
  private static final int DEFAULT_MIN_PERCENT = 18;
  
  String sentenceMessage = null;
  
  public SentenceWithModalVerbRule(ResourceBundle messages, Language lang, UserConfig userConfig) {
    super(messages, lang, userConfig, DEFAULT_MIN_PERCENT);
  }

  /**
   * Word is a modal verb
   */
  private static boolean isModalVerb(AnalyzedTokenReadings token) {
    return (token.hasPosTagStartingWith("VER:MOD"));  
  }
  
  /**
   * Is sentence with modal verb
   */
  @Override
  protected AnalyzedTokenReadings conditionFulfilled(List<AnalyzedTokenReadings> sentence) {
    for (int i = 0; i < sentence.size(); i++) {
      if(isModalVerb(sentence.get(i))) {
        AnalyzedTokenReadings token = sentence.get(i);
        for (i++; i < sentence.size(); i++) {
          if(sentence.get(i).hasPosTagStartingWith("VER:INF")) {
            return token;
          } else if(isMark(sentence.get(i))) {
            return null;
          }
        }
      } else if (sentence.get(i).hasPosTagStartingWith("VER:INF")) {
        for (i++; i < sentence.size(); i++) {
          if(isModalVerb(sentence.get(i))) {
            return sentence.get(i);
          } else if(isMark(sentence.get(i))) {
            return null;
          }
        }
      }
    }
    return null;
  }
  
  @Override
  protected boolean excludeDirectSpeech() {
    return true;
  }

  @Override
  protected String getLimitMessage(int limit, double percent) {<FILL_FUNCTION_BODY>}

  @Override
  public String getId() {
    return "SENTENCE_WITH_MODAL_VERB_DE";
  }

  @Override
  public String getDescription() {
    return "Statistische Stilanalyse: Sätze mit Modalverben";
  }

  @Override
  public String getConfigureText() {
    return "Anzeigen wenn mehr als ...% Sätze eines Kapitels Modalverben enthalten:";
  }

}

    if (limit == 0) {
      return "Modalverb: Modalverben blähen den Text häufig auf und sollten vermieden werden.";
    }
    return "Mehr als " + limit + "% Sätze mit Modalverben {" + ((int) (percent +0.5d)) + "%} gefunden. Modalverben blähen den Text häufig auf und sollten vermieden werden.";
  
<methods>public void <init>(java.util.ResourceBundle, org.languagetool.Language, org.languagetool.UserConfig, int, boolean) ,public void <init>(java.util.ResourceBundle, org.languagetool.Language, org.languagetool.UserConfig, int) ,public double denominator() ,public abstract java.lang.String getConfigureText() ,public int getDefaultValue() ,public int getMaxConfigurableValue() ,public int getMinConfigurableValue() ,public int getNumberOfMatches() ,public int getSentenceCount() ,public boolean hasConfigurableValue() ,public org.languagetool.rules.RuleMatch[] match(List<org.languagetool.AnalyzedSentence>) throws java.io.IOException,public int minToCheckParagraph() ,public void setWithoutDirectSpeech(boolean) <variables>private static final boolean DEFAULT_ACTIVATION,private static final java.util.regex.Pattern ENDING_QUOTES,private static final java.util.regex.Pattern MARKS_REGEX,private static final java.util.regex.Pattern OPENING_QUOTES,private final non-sealed int defaultMinPercent,private final non-sealed int minPercent,private int numMatches,private int sentenceCount,private boolean withoutDirectSpeech