private void addDescendants(TreeNode n, List<TreeNode> children, NodeOrder order) {

        if (order == NodeOrder.PREORDER) {
            for (TreeNode c : n.getChildren()){
                addDescendants(c, children, order);
            }
            children.add(n);

        } else if (order == NodeOrder.POSTORDER) {
            children.add(n);

            for (TreeNode c : n.getChildren()){
                addDescendants(c, children, order);
            }
        }
    }