antiId = ruleGroupId + "[" + subId + "]";
} else {
antiId = ruleGroupId;
}
}
final DisambiguationPatternRule rule = new DisambiguationPatternRule(
antiId + "_antipattern:" + antiPatternCounter,
"antipattern", language, elementList, null, null,
DisambiguationPatternRule.DisambiguatorAction.IMMUNIZE);
if (startPos != -1 && endPos != -1) {
rule.setStartPositionCorrection(startPos);
rule.setEndPositionCorrection(endPos - tokenCountForMarker);
} else {
// No '<marker>'? Then add artificial <marker>s around all tokens to work
// around issue https://github.com/languagetool-org/languagetool/issues/189:
for (Element element : elementList) {
element.setInsideMarker(true);