private long grow ( PrintStream out , List < ItemSet > list , TotalSupportTree ttree , FPTree . Node node , int [ ] itemset , int support ) { int height = 0 ; for ( FPTree . Node currentNode = node ; currentNode != null ; currentNode = currentNode . parent ) { height ++ ; } int n = 0 ; if ( height > 0 ) { int [ ] items = new int [ height ] ; int i = 0 ; for ( FPTree . Node currentNode = node ; currentNode != null ; currentNode = currentNode . parent ) { items [ i ++ ] = currentNode . id ; } int [ ] itemIndexStack = new int [ height ] ; int itemIndexStackPos = 0 ; itemset = insert ( itemset , items [ itemIndexStack [ itemIndexStackPos ] ] ) ; collect ( out , list , ttree , itemset , support ) ; n ++ ; while ( itemIndexStack [ 0 ] < height - 1 ) { if ( itemIndexStack [ itemIndexStackPos ] < height - 1 ) { itemIndexStackPos ++ ; itemIndexStack [ itemIndexStackPos ] = itemIndexStack [ itemIndexStackPos - 1 ] + 1 ; itemset = insert ( itemset , items [ itemIndexStack [ itemIndexStackPos ] ] ) ; collect ( out , list , ttree , itemset , support ) ; n ++ ; } else { itemset = drop ( itemset ) ; if ( itemset != null ) { itemIndexStackPos -- ; itemIndexStack [ itemIndexStackPos ] = itemIndexStack [ itemIndexStackPos ] + 1 ; itemset [ 0 ] = items [ itemIndexStack [ itemIndexStackPos ] ] ; collect ( out , list , ttree , itemset , support ) ; n ++ ; } } } } return n ; }
Mines all combinations along a single path tree