Class FPGrowth.FPNode

  • Direct Known Subclasses:
    FPGrowth.FPTree
    Enclosing class:
    FPGrowth

    public static class FPGrowth.FPNode
    extends java.lang.Object
    A single node of the FP tree.
    Author:
    Erich Schubert
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static interface  FPGrowth.FPNode.Translator
      Translator class for tree printing.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) FPGrowth.FPNode[] children
      Children.
      (package private) int count
      Key, weight, and number of children.
      (package private) static FPGrowth.FPNode[] EMPTY_CHILDREN
      Constant for leaf nodes.
      (package private) int INITIAL_SIZE
      Initial size, after sizes 0 and 1.
      (package private) int key
      Key, weight, and number of children.
      (package private) int numchildren
      Key, weight, and number of children.
      (package private) FPGrowth.FPNode parent
      Parent node and next in sequence.
      (package private) FPGrowth.FPNode sibling
      Parent node and next in sequence.
      private static char[] SPACES
      Buffer for indentation.
    • Constructor Summary

      Constructors 
      Constructor Description
      FPNode​(FPGrowth.FPNode parent, int key)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.StringBuilder appendTo​(java.lang.StringBuilder buf, FPGrowth.FPNode.Translator t)
      Debugging function: build a text representation of the tree.
      private java.lang.StringBuilder appendTo​(java.lang.StringBuilder buf, FPGrowth.FPNode.Translator t, int depth)
      Debugging function: build a text representation of the tree.
      private void ensureSize()
      Ensure we have enough storage.
      void insert​(FPGrowth.FPTree tree, int[] buf, int i, int l, int weight)
      Insert an itemset into the tree.
      void reduceMemory()
      Release the memory occupied for the parent-to-child navigation, which is no longer needed after building the tree (only child-to-parent is needed in extracting itemsets).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • key

        int key
        Key, weight, and number of children.
      • count

        int count
        Key, weight, and number of children.
      • numchildren

        int numchildren
        Key, weight, and number of children.
      • EMPTY_CHILDREN

        static final FPGrowth.FPNode[] EMPTY_CHILDREN
        Constant for leaf nodes.
      • INITIAL_SIZE

        final int INITIAL_SIZE
        Initial size, after sizes 0 and 1.
        See Also:
        Constant Field Values
      • SPACES

        private static final char[] SPACES
        Buffer for indentation.
    • Constructor Detail

      • FPNode

        public FPNode​(FPGrowth.FPNode parent,
                      int key)
        Constructor.
        Parameters:
        parent - Parent node
        key - Key
    • Method Detail

      • insert

        public void insert​(FPGrowth.FPTree tree,
                           int[] buf,
                           int i,
                           int l,
                           int weight)
        Insert an itemset into the tree.
        Parameters:
        buf - Itemset buffer
        i - Current index
        l - Length
        weight - Weight
      • ensureSize

        private void ensureSize()
        Ensure we have enough storage.
      • appendTo

        public java.lang.StringBuilder appendTo​(java.lang.StringBuilder buf,
                                                FPGrowth.FPNode.Translator t)
        Debugging function: build a text representation of the tree.
        Parameters:
        buf - Output buffer
        t - Translator to user-understandable items
        Returns:
        Buffer
      • appendTo

        private java.lang.StringBuilder appendTo​(java.lang.StringBuilder buf,
                                                 FPGrowth.FPNode.Translator t,
                                                 int depth)
        Debugging function: build a text representation of the tree.
        Parameters:
        buf - Output buffer
        t - Translator to user-understandable items
        depth - Current depth
        Returns:
        Buffer
      • reduceMemory

        public void reduceMemory()
        Release the memory occupied for the parent-to-child navigation, which is no longer needed after building the tree (only child-to-parent is needed in extracting itemsets).