Class Trees


  • public class Trees
    extends Object
    Utility class for PivotHeaderTree
    Author:
    simonpai
    • Constructor Detail

      • Trees

        public Trees()
    • Method Detail

      • getSubtotalCount

        public static int getSubtotalCount​(PivotHeaderNode node)
        Return the count of subtotal Calculators on a node
      • getSubtotalCount

        public static int getSubtotalCount​(PivotHeaderNode node,
                                           boolean open)
        Return the count of subtotal Calculators on a node
        Parameters:
        open - compute as if the node were always open.
      • getSubtotalCount

        public static int getSubtotalCount​(PivotField field)
        Return the count of subtotal Calculators on a field
      • getCalculator

        public static Calculator getCalculator​(PivotHeaderNode node,
                                               int index)
        Retrieves the Calculator from a node by index.
      • getCalculator

        public static Calculator getCalculator​(PivotField field,
                                               int index)
        Retrieves the Calculator from a field by index.
      • getKey

        public static Object getKey​(PivotField field,
                                    Object value)
        Returns the key defined by GroupHandler on the field, if any.
      • getSize

        public static int getSize​(PivotHeaderTree tree)
        Compute the size of tree. Subtotal Calculator numbers are taken into account. A full traversal of the tree will be performed upon calling this method.
      • getSize

        public static int getSize​(PivotHeaderTree tree,
                                  boolean open)
        Compute the size of tree. Subtotal Calculator numbers are taken into account. A full traversal of the tree will be performed upon calling this method.
        Parameters:
        open - compute as if all nodes were open
      • isTerminal

        public static boolean isTerminal​(PivotHeaderNode node)
        Return true if node is leaf or closed.
      • isRoot

        public static boolean isRoot​(PivotHeaderNode node)
        Return true if node is root.
      • getNode

        public static PivotHeaderNode getNode​(PivotHeaderTree tree,
                                              int[] indicies)
        Seek down PivotHeaderNode by indices.
        Returns:
        null if not found
      • openDown

        public static void openDown​(PivotHeaderNode node,
                                    boolean open)
        Recursively set open or close to a node and all its descendants.
      • traverse

        public static void traverse​(PivotHeaderTree tree,
                                    boolean open,
                                    Trees.NodeRunner runner)
        Traverse the tree in a depth first, children first fashion.
        Parameters:
        open - traverse as if all nodes were open.
      • traverse

        public static void traverse​(PivotHeaderTree tree,
                                    boolean asIfOpenAll,
                                    int offset,
                                    int limit,
                                    Trees.NodeRunner runner)
        Traverse the tree in a depth first, children first fashion, while concern paging. runner will not be invoked on nodes that are completely out of range.
        Parameters:
        asIfOpenAll - traverse as if all nodes were open.
        offset -
        limit - no limit if negative