private void buildChildren(final List<Block> result, final Alignment childAlignment, final Wrap childWrap) {
    ASTNode child = myNode.getFirstChildNode();

    int state = BEFORE_FIRST;

    if (myNode.getPsi() instanceof PsiSyntheticClass) {
      state = INSIDE_BODY;
    }

    ChildAlignmentStrategyProvider provider = getStrategyProvider();
    while (child != null) {
      if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0) {
        AlignmentStrategy alignmentStrategy = provider.getNextChildStrategy(child);
        final Indent indent = calcCurrentIndent(child, state);
        state = calcNewState(child, state);

        if (child.getElementType() == JavaElementType.SWITCH_LABEL_STATEMENT) {
          child = processCaseAndStatementAfter(result, child, childAlignment, childWrap, indent);
        }
        else if ((myNode.getPsi() instanceof PsiClass || myNode.getPsi() instanceof PsiJavaModule) &&
                 child.getElementType() == JavaTokenType.LBRACE) {
          child = composeCodeBlock(result, child, getCodeBlockExternalIndent(), myChildrenIndent, null);
        }
        else if (myNode.getElementType() == JavaElementType.CODE_BLOCK &&
                 child.getElementType() == JavaTokenType.LBRACE &&
                 myNode.getTreeParent().getElementType() == JavaElementType.METHOD) {
          child = composeCodeBlock(result, child, indent, myChildrenIndent, childWrap);
        }
        else {
          child = processChild(result, child, alignmentStrategy, childWrap, indent);
        }
      }
      if (child != null) {
        child = child.getTreeNext();
      }
    }
  }
private void buildChildren(final List<Block> result, final Alignment childAlignment, final Wrap childWrap)