String (@NotNull String className, @NotNull String separator, @NotNull GenerationNode node, boolean isModifierSeparator) { Pair<String, Integer> cleanStringAndDepth = getCleanStringAndDepth(className, separator); Integer depth = cleanStringAndDepth.second; if (depth > 0) { GenerationNode donor = node; while (donor.getParent() != null && depth > 0) { donor = donor.getParent(); depth--; } BemState bemState = BEM_STATE.get(donor); if (bemState != null) { String prefix = bemState.getBlock(); if (!StringUtil.isEmpty(prefix)) { String element = bemState.getElement(); if (isModifierSeparator && !StringUtil.isEmpty(element)) { prefix = prefix + separator + element; } return prefix + separator + cleanStringAndDepth.first; } } } return className; }