public WhiteSpaceBeforeParagraphEnd(ResourceBundle messages, Language lang, boolean defaultActive) { super(messages); super.setCategory(Categories.STYLE.getCategory(messages)); this.lang = lang; if (!defaultActive) { setDefaultOff(); } setOfficeDefaultOn(); setLocQualityIssueType(ITSIssueType.Style); }
@Override public RuleMatch[] match(List<AnalyzedSentence> sentences) throws IOException { List<RuleMatch> ruleMatches = new ArrayList<>(); int pos = 0; for (int n = 0; n < sentences.size(); n++) { AnalyzedSentence sentence = sentences.get(n); if(n == sentences.size() - 1 || sentence.hasParagraphEndMark(lang)) { AnalyzedTokenReadings[] tokens = sentence.getTokens(); int lb; int lw; for (lb = tokens.length - 1; lb > 0 && tokens[lb].isLinebreak(); lb--); for (lw = lb; lw > 0 && tokens[lw].isWhitespace(); lw--); if(lw < lb) { int fromPos = pos + tokens[lw].getStartPos(); int toPos = pos + tokens[lb].getEndPos(); RuleMatch ruleMatch = new RuleMatch(this, sentence, fromPos, toPos, messages.getString("whitespace_before_parapgraph_end_msg")); if (lw > 0 && !tokens[lw].isWhitespace()) { ruleMatch.setSuggestedReplacement(tokens[lw].getToken()); } else { ruleMatch.setSuggestedReplacement(""); } ruleMatches.add(ruleMatch); } } pos += sentence.getText().length(); } return toRuleMatchArray(ruleMatches); }
new LongParagraphRule(messages, this, userConfig), new SentenceWhitespaceRule(messages), new WhiteSpaceBeforeParagraphEnd(messages, this), new WhiteSpaceAtBeginOfParagraph(messages), new EmptyLineRule(messages, this),
new SimilarNameRule(messages), new WiederVsWiderRule(messages), new WhiteSpaceBeforeParagraphEnd(messages, this), new WhiteSpaceAtBeginOfParagraph(messages), new EmptyLineRule(messages, this),
public WhiteSpaceBeforeParagraphEnd(ResourceBundle messages, Language lang, boolean defaultActive) { super(messages); super.setCategory(Categories.STYLE.getCategory(messages)); this.lang = lang; if (!defaultActive) { setDefaultOff(); } setOfficeDefaultOn(); setLocQualityIssueType(ITSIssueType.Style); }
@Override public RuleMatch[] match(List<AnalyzedSentence> sentences) throws IOException { List<RuleMatch> ruleMatches = new ArrayList<>(); int pos = 0; for (int n = 0; n < sentences.size(); n++) { AnalyzedSentence sentence = sentences.get(n); if(n == sentences.size() - 1 || sentence.hasParagraphEndMark(lang)) { AnalyzedTokenReadings[] tokens = sentence.getTokens(); int lb; int lw; for (lb = tokens.length - 1; lb > 0 && tokens[lb].isLinebreak(); lb--); for (lw = lb; lw > 0 && tokens[lw].isWhitespace(); lw--); if(lw < lb) { int fromPos = pos + tokens[lw].getStartPos(); int toPos = pos + tokens[lb].getEndPos(); RuleMatch ruleMatch = new RuleMatch(this, sentence, fromPos, toPos, messages.getString("whitespace_before_parapgraph_end_msg")); if (lw > 0 && !tokens[lw].isWhitespace()) { ruleMatch.setSuggestedReplacement(tokens[lw].getToken()); } else { ruleMatch.setSuggestedReplacement(""); } ruleMatches.add(ruleMatch); } } pos += sentence.getText().length(); } return toRuleMatchArray(ruleMatches); }