Class TRT_TreeNode

  • All Implemented Interfaces:
    TestResultTable.TreeNode

    public class TRT_TreeNode
    extends java.lang.Object
    implements TestResultTable.TreeNode
    This is the implementation of a tree node structure for TestResultTable. Only the interface implementation is meant to be exposed. Assumptions are made that this is the only node class (implementation of TreeNode) used in the tree.
    • Field Detail

      • debug

        protected static int debug
    • Method Detail

      • getSize

        public int getSize()
        Find out how many tests are in this node and below. If you invoke this on a node which is being lazily read from a TestFinder, this may cause a synchronous retrieval of data from the TestFinder. Use with caution!
        Specified by:
        getSize in interface TestResultTable.TreeNode
        Returns:
        The number of tests under this node.
      • getEstimatedSize

        public int getEstimatedSize()
        Get the estimated number of tests below this node. Mainly useful for low contention hints about the size. No locking is involved in retrieving the information.
      • isRoot

        public boolean isRoot()
        Description copied from interface: TestResultTable.TreeNode
        Is this the root of a tree. A parent of null indicates this state.
        Specified by:
        isRoot in interface TestResultTable.TreeNode
        Returns:
        True if this is the root node, false otherwise.
      • isUpToDate

        public boolean isUpToDate()
        Description copied from interface: TestResultTable.TreeNode
        Has the finder been used to scan this node from secondary storage?. This is an important performance consideration, since reading nodes may cause a noticable pause. This method may allow you to defer performance penalties. This method has no effect if a finder is not being used by the TestResultTable.
        Specified by:
        isUpToDate in interface TestResultTable.TreeNode
        Returns:
        True if this location in tree has already been processed, false otherwise.
      • getChildCount

        public int getChildCount()
        Find out how many children this node contains. If you invoke this on a node which is being lazily read from a TestFinder, this may cause a synchronous retrieval of data from the TestFinder.
        Specified by:
        getChildCount in interface TestResultTable.TreeNode
        Returns:
        The number of immediate children this node has.
      • getChild

        public java.lang.Object getChild​(int index)
        Description copied from interface: TestResultTable.TreeNode
        Get the child at the specified location. May be either a TestResult or TreeNode. If you invoke this on a node which is being lazily read from a TestFinder, this may cause a synchronous retrieval of data from the TestFinder.
        Specified by:
        getChild in interface TestResultTable.TreeNode
        Parameters:
        index - The location to retrieve.
        Returns:
        Null if there are no children here or the specified index if out of range.
      • isLeaf

        public boolean isLeaf​(int index)
        Description copied from interface: TestResultTable.TreeNode
        Is the given element of this node a leaf. In general this means that the element is a TestResult. It may also mean that the TreeNode is empty, which indicates a testsuite which is not well designed and needs trimming.
        Specified by:
        isLeaf in interface TestResultTable.TreeNode
        Parameters:
        index - The element index of this node. An out of range index will return false.
        Returns:
        True if the element at the given index is a leaf.
      • getChildStatus

        public int[] getChildStatus()
        Description copied from interface: TestResultTable.TreeNode
        Get the statistics for the state of tests under this node.
        Specified by:
        getChildStatus in interface TestResultTable.TreeNode
        Returns:
        An array of length Status.NUM_STATES, positionally representing the number of tests under this node with that state.
      • getIndex

        public int getIndex​(java.lang.Object target)
        Description copied from interface: TestResultTable.TreeNode
        Search for a specific item in this node.
        Specified by:
        getIndex in interface TestResultTable.TreeNode
        Parameters:
        target - The target object should either be of type TreeNode or TestResult
        Returns:
        The index at which the target object is located in this node. -1 if not found in in this node. -2 if the parameter is null
      • matchTest

        public TestResult matchTest​(java.lang.String url)
        Description copied from interface: TestResultTable.TreeNode
        Finds a TestResult in this node with the given name. This is a match against the test URL, not the filename. This is not recursive of course; it just does a straight match against all tests in this node.
        Specified by:
        matchTest in interface TestResultTable.TreeNode
        Parameters:
        url - The full name of the test to find.
        Returns:
        The matching test result object, or null if not found. Also null if this node has no children.
        See Also:
        TestDescription.getRootRelativeURL()
      • refreshIfNeeded

        public boolean refreshIfNeeded()
        Refresh this entire node if necessary. This means create any new nodes, and update any test descriptions.
        Returns:
        True if some changes in this node were needed, false otherwise.
        See Also:
        TestResultTable.refreshIfNeeded(String)