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