Module org.jpo

Class NodeStatistics

java.lang.Object
org.jpo.datamodel.NodeStatistics

public class NodeStatistics extends Object
A Class that counts nodes, groups, pictures and disk usage on the supplied node
  • Constructor Details

    • NodeStatistics

      public NodeStatistics(@NotNull @NotNull DefaultMutableTreeNode nodeToAnalyse)
      Constructs a NodeStatistics Object for the supplied node
      Parameters:
      nodeToAnalyse - The node for which to perform the analysis
  • Method Details

    • setNode

      public final void setNode(DefaultMutableTreeNode nodeToAnalyse)
      Sets the node to be analysed
      Parameters:
      nodeToAnalyse - the nodes
    • getNode

      public DefaultMutableTreeNode getNode()
      Returns the node being analysed.
      Returns:
      the node being analysed
    • getNumberOfNodes

      public int getNumberOfNodes()
      Returns the number of nodes including the root node in the tree
      Returns:
      The number of nodes including the root node
    • countNodes

      public static int countNodes(@NotNull @NotNull TreeNode start)
      Recursive static method that loops through the child nodes to find the number of nodes. Returns 0 if the node is null.
      Parameters:
      start - The node on which to start
      Returns:
      The number of nodes including the root node or 0 if null is supplied.
    • getNumberOfNodesString

      public String getNumberOfNodesString()
      Returns the number of nodes with the multilingual label in front of the number.
      Returns:
      Returns the number of nodes with the multilingual label in front of the number
    • getNumberOfGroups

      public int getNumberOfGroups()
      Returns the number of groups in the supplied node.
      Returns:
      Returns the number of groups in the supplied node.
    • getNumberOfGroupsString

      public String getNumberOfGroupsString()
      Returns a multilingual label with the number of Groups
      Returns:
      Returns a multilingual label with the number of Groups
    • getNumberOfPictures

      public int getNumberOfPictures()
      Returns the number of Pictures found in the supplied node.
      Returns:
      Returns the number of Pictures found in the supplied node.
    • getNumberOfPicturesString

      public String getNumberOfPicturesString()
      Returns the number of Pictures found in the supplied node prefixed with the multilingual label
      Returns:
      Returns the number of Pictures found in the supplied node prefixed with the multilingual label
    • countPicturesRecursively

      public static int countPicturesRecursively(DefaultMutableTreeNode startNode)
      Returns the number of PictureInfo nodes in a subtree recursing through the Groups.
      Parameters:
      startNode - The Start node
      Returns:
      The number of PictureInfo nodes
    • countPictures

      public static int countPictures(DefaultMutableTreeNode startNode, boolean recurseSubgroups)
      Returns the number of PictureInfo Nodes in a subtree. Useful for progress monitors. If called with a null start node it returns 0. If called with a node that is actually a Query object it asks the Query for the count.
      Parameters:
      startNode - the node from which to count
      recurseSubgroups - indicator to say whether the next levels of groups should be counted too or not.
      Returns:
      the number of PictureInfo nodes
    • getSizeOfPictures

      public long getSizeOfPictures()
      Returns the bytes of the pictures underneath the supplied node
      Returns:
      Returns the bytes of the pictures underneath the supplied node
    • getSizeOfPicturesString

      public String getSizeOfPicturesString()
      Returns the bytes of the pictures underneath the supplied node as a String
      Returns:
      Returns the bytes of the pictures underneath the supplied node