class DuUpperLowerCaseRule extends TextLevelRule {

  private static final Set<String> lowerWords = new HashSet<>(
          Arrays.asList("du", "dir", "dich", "dein", "deine", "deines", "deins", "deiner", "deinen", "deinem",
                        "euch", "euer", "eure", "euere", "euren", "eueren", "euern", "eurer", "euerer",
                        "eurem", "euerem", "eures", "eueres")
  );

  public DuUpperLowerCaseRule(ResourceBundle messages) {
    super(messages);
    super.setCategory(Categories.CASING.getCategory(messages));
    addExamplePair(Example.wrong("Wie geht es Dir? Bist <marker>du</marker> wieder gesund?"),
                   Example.fixed("Wie geht es Dir? Bist <marker>Du</marker> wieder gesund?"));
    setUrl(Tools.getUrl("https://languagetool.org/insights/de/beitrag/duzen-grossgeschrieben/"));
  }

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

  @Override
  public String getDescription() {
    return "Einheitliche Verwendung von Du/du, Dir/dir etc.";
  }

  @Override
  public RuleMatch[] match(List<AnalyzedSentence> sentences) throws IOException {<FILL_FUNCTION_BODY>}

  @Override
  public int minToCheckParagraph() {
    return -1;
  }

}

    String firstUse = null;
    List<RuleMatch> ruleMatches = new ArrayList<>();
    int pos = 0;
    for (AnalyzedSentence sentence : sentences) {
      AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace();
      for (int i = 0; i < tokens.length; i++) {
        if (i > 0 && (tokens[i-1].isSentenceStart() || StringUtils.equalsAny(tokens[i-1].getToken(), "\"","„", "‚", ":", "»", "«", "“", "-", "–", "*", "•", "\\u2063", "\\u25E6", "\\u00B7"))) {
          continue;
        }
        AnalyzedTokenReadings token = tokens[i];
        String word = token.getToken();
        String lcWord = word.toLowerCase();
        if (lowerWords.contains(lcWord)) {
          if (firstUse == null) {
            firstUse = word;
          } else {
            boolean firstUseIsUpper = StringTools.startsWithUppercase(firstUse);
            String msg = null;
            String replacement = null;
            if (firstUseIsUpper && !StringTools.startsWithUppercase(word)) {
              replacement =  StringTools.uppercaseFirstChar(word);
              msg = "Vorher wurde bereits '" + firstUse + "' großgeschrieben. " +
                      "Aus Gründen der Einheitlichkeit '" + replacement + "' hier auch großschreiben?";
            } else if (!firstUseIsUpper && StringTools.startsWithUppercase(word) && !StringUtils.isAllUpperCase(word)) {
              replacement = StringTools.lowercaseFirstChar(word);
              msg = "Vorher wurde bereits '" + firstUse + "' kleingeschrieben. " +
                      "Aus Gründen der Einheitlichkeit '" + replacement + "' hier auch kleinschreiben?";
            }
            if (msg != null) {
              RuleMatch ruleMatch = new RuleMatch(this, sentence, pos + token.getStartPos(), pos + token.getEndPos(), msg);
              ruleMatch.setSuggestedReplacement(replacement);
              ruleMatches.add(ruleMatch);
            }
          }
        }
      }
      pos += sentence.getCorrectedTextLength();
    }
    return toRuleMatchArray(ruleMatches);
  
<methods>public void <init>() ,public void <init>(java.util.ResourceBundle) ,public int estimateContextForSureMatch() ,public org.languagetool.rules.RuleMatch[] match(List<org.languagetool.AnalyzedSentence>, org.languagetool.markup.AnnotatedText) throws java.io.IOException,public abstract org.languagetool.rules.RuleMatch[] match(List<org.languagetool.AnalyzedSentence>) throws java.io.IOException,public final org.languagetool.rules.RuleMatch[] match(org.languagetool.AnalyzedSentence) throws java.io.IOException,public abstract int minToCheckParagraph() <variables>