ThreeState (@NotNull String tagToClose, @NotNull String openingTag, boolean caseSensitive) { var normalizedTagToClose = caseSensitive ? tagToClose : StringUtil.toLowerCase(tagToClose); var normalizedOpeningTag = caseSensitive ? openingTag : StringUtil.toLowerCase(openingTag); if (!isTagWithOptionalEnd(normalizedTagToClose, true)) { return ThreeState.NO; } final Set<String> closingTags = AUTO_CLOSE_BY_OPENING_TAG.get(normalizedTagToClose); if (closingTags != null && closingTags.contains(normalizedOpeningTag)) { return ThreeState.YES; } return ThreeState.UNSURE; }