Interface TestResultTable.TreeNode

  • All Known Implementing Classes:
    TRT_TreeNode
    Enclosing class:
    TestResultTable

    public static interface TestResultTable.TreeNode
    Interface to a node which contitutes the skeleton of the test result tree. These are in most cases equivalent to directories or folders.
    • Method Detail

      • addObserver

        void addObserver​(TestResultTable.TreeNodeObserver obs)
        Add a observer for this particular node.
        Parameters:
        obs - The observer to attach to this node. Should never be null.
      • removeObserver

        void removeObserver​(TestResultTable.TreeNodeObserver obs)
        Add a observer for this particular node.
        Parameters:
        obs - The observer to remove. No effect if it was never attached.
      • getSize

        int getSize()
        Find out how many nodes are contained in this one and below. Use with care, this may be a high overhead call.
        Returns:
        The number of tests under this node.
      • getParent

        TestResultTable.TreeNode getParent()
        Get the parent of this node.
        Returns:
        Null if this is the root. Another TreeNode otherwise.
      • isRoot

        boolean isRoot()
        Is this the root of a tree. A parent of null indicates this state.
        Returns:
        True if this is the root node, false otherwise.
      • getEnclosingTable

        TestResultTable getEnclosingTable()
        Find out what TestResultTable this node is part of.
        Returns:
        The TRT instance which this node is contained.
      • isUpToDate

        boolean isUpToDate()
        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.
        Returns:
        True if this location in tree has already been processed, false otherwise.
      • getChildCount

        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.
        Returns:
        The number of immediate children this node has.
      • getChild

        java.lang.Object getChild​(int index)
        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.
        Parameters:
        index - The location to retrieve.
        Returns:
        Null if there are no children here or the specified index if out of range.
      • getTestResults

        TestResult[] getTestResults()
        Get any immediate children of this node which are test result objects.
        Returns:
        List of TestResult objects in this node. null if none
      • getTreeNodes

        TestResultTable.TreeNode[] getTreeNodes()
        Get any immediate children of this node which are tree nodes.
        Returns:
        List of children nodes objects in this node. null if none
      • isLeaf

        boolean isLeaf​(int index)
        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.
        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

        int[] getChildStatus()
        Get the statistics for the state of tests under this node.
        Returns:
        An array of length Status.NUM_STATES, positionally representing the number of tests under this node with that state.
      • getIndex

        int getIndex​(java.lang.Object target)
        Search for a specific item in this node.
        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

        TestResult matchTest​(java.lang.String url)
        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.
        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()