int (@NotNull IElementType type) { // no lock is needed because all chameleons are expanded already int count = 0; for (ASTNode child = getFirstChildNode(); child != null; child = child.getTreeNext()) { if (type == child.getElementType()) { count++; } } return count; }