public void addChildToList(Node n, String prefix, ArrayList<String> list) {
        if (n.getChildren().size() > 0) {
            for (Node child : n.getChildren()) {
                if (prefix != null && "-".equals(child.getToken())) {
                    if (!list.contains(prefix)) {
                        list.add(prefix);
                    }
                    return;
                }
                String text = (prefix == null ? "" : prefix + " ") + child.getToken();
                // list.add(text);
                addChildToList(child,text,list);
            }
        } else {
            if (!list.contains(prefix)) {
                list.add(prefix);
            }
        }
    }
public void addChildToList(Node n, String prefix, ArrayList<String> list) {
        if (n.getChildren().size() > 0) {
            for (Node child : n.getChildren()) {
                if (prefix != null && "-".equals(child.getToken())) {
                    if (!list.contains(prefix)) {
                        list.add(prefix);
                    }
                    return;
                }
                String text = (prefix == null ? "" : prefix + " ") + child.getToken();
                
                addChildToList(child,text,list);
            }
        } else {
            if (!list.contains(prefix)) {
                list.add(prefix);
            }
        }
    }
public void addChildToList ( Node n , String prefix , ArrayList < String > list ) { if ( n . getChildren ( ) . size ( ) > 0 ) { for ( Node child : n . getChildren ( ) ) { if ( prefix != null && "-" . equals ( child . getToken ( ) ) ) { if ( ! list . contains ( prefix ) ) { list . add ( prefix ) ; } return ; } String text = ( prefix == null ? "" : prefix + " " ) + child . getToken ( ) ; // list.add(text); addChildToList ( child , text , list ) ; } } else { if ( ! list . contains ( prefix ) ) { list . add ( prefix ) ; } } }
method will prepend the parent text to the child and generate
the possible combinations in text format.
@param n
@param prefix
@param list
method will prepend the parent text to the child and generate the possible combinations in text format .