Class Tree

java.lang.Object
com.appiancorp.suiteapi.common.TreeNode
com.appiancorp.suiteapi.common.Tree
All Implemented Interfaces:
Serializable

public class Tree extends TreeNode
Collection of objects such that each object has data and potentially references to other Trees, subject to the following restrictions:
  • Each tree has exactly one root.
  • The root of the tree has no parent; all other nodes have exactly one parent.
  • Each node may have an unbounded number of child nodes, possibly zero.
  • The child nodes are themselves the roots of sub-trees.

The data of each node is the set of properties inherited from TreeNode.
See Also:
  • Field Details

    • SORT_BY_NODE_ID

      public static final Integer SORT_BY_NODE_ID
      A constant for sorting trees by the ID of the nodes
    • SORT_BY_NAME

      public static final Integer SORT_BY_NAME
      A constant for sorting trees by the name of the nodes
    • SORT_BY_DATA

      public static final Integer SORT_BY_DATA
      A constant for sorting tress by data field of the nodes
  • Constructor Details

    • Tree

      public Tree()
  • Method Details

    • getChildren

      public Tree[] getChildren()
      Get the children of this node.
      Returns:
      An array of Tree objects that are the root of children trees.
      See Also:
    • setChildren

      public void setChildren(Tree[] children_)
      Set the children of this node.
      Parameters:
      children_ - an array of child trees
      See Also:
    • retrieveTreeIds

      public Long[] retrieveTreeIds()
      Convenience method to obtain a flat represention of the tree. Uses the same traversal as populateTree(java.lang.Object[]). This order is known as preorder, which means that the root node is visited before any of its children.
      Returns:
      the ids of the nodes in the tree in a one-dimensional array.
    • retrieveTreeData

      public Object[] retrieveTreeData()
      Convenience method to obtain a flat represention of the data in the tree. Uses the same traversal as populateTree(java.lang.Object[]). This order is known as preorder, which means that the root node is visited before any of its children.
      Returns:
      The data in the nodes in the tree in a one-dimensional array.
    • retrieveTreeNames

      public String[] retrieveTreeNames()
      Convenience method to obtain a flat represention of the names of the tree nodes. Uses the same traversal as populateTree(java.lang.Object[]). This order is known as preorder, which means that the root node is visited before any of its children.
      Returns:
      The names of the nodes in the tree in a one-dimensional array.
    • retrieveTreeDepths

      public Integer[] retrieveTreeDepths()
      Convenience method to obtain a flat represention of the depths of the nodes in the tree. The depth of the top-level node is 0, the depth of its direct descendants is 1, and so on. Uses the same traversal as populateTree(java.lang.Object[]). This order is known as preorder, which means that the root node is visited before any of its children.
      Returns:
      The depths of the nodes in the tree in a one-dimensional array.
    • populateTree

      public void populateTree(Object[] data_)
      Convenience method to populate the node data of nodes in this tree. Uses the same traversal as retrieveTreeIds(). This order is known as preorder, which means that the root node is visited before any of its children.
      Parameters:
      data_ - A one-dimensional array of data to use to populate tree.