Class TRT_TreeNode
java.lang.Object
com.sun.javatest.TRT_TreeNode
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an observer to watch this node for changes.getChild(int index) Get the child at the specified location.intFind out how many children this node contains.int[]Get the statistics for the state of tests under this node.Find out what TestResultTable this node is part of.intGet the estimated number of tests below this node.intSearch for a specific item in this node.getName()The name of this node, not including all the ancestors names.Get the parent of this node.intgetSize()Find out how many tests are in this node and below.Get any immediate children of this node which are test result objects.Get only the children of this node which are branches.booleanisLeaf(int index) Is the given element of this node a leaf.booleanisRoot()Is this the root of a tree.booleanHas the finder been used to scan this node from secondary storage?.Finds a TestResult in this node with the given name.booleanRefresh this entire node if necessary.voidRemove an observer that was previously added.
-
Field Details
-
debug
protected static int debug
-
-
Method Details
-
addObserver
Add an observer to watch this node for changes.- Specified by:
addObserverin interfaceTestResultTable.TreeNode- Parameters:
obs- The observer to attach to this node. Should never be null.
-
removeObserver
Remove an observer that was previously added.- Specified by:
removeObserverin interfaceTestResultTable.TreeNode- Parameters:
obs- The observer to remove. No effect if it was never attached.
-
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:
getSizein interfaceTestResultTable.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. -
getParent
Description copied from interface:TestResultTable.TreeNodeGet the parent of this node.- Specified by:
getParentin interfaceTestResultTable.TreeNode- Returns:
- Null if this is the root. Another TreeNode otherwise.
-
isRoot
public boolean isRoot()Description copied from interface:TestResultTable.TreeNodeIs this the root of a tree. A parent of null indicates this state.- Specified by:
isRootin interfaceTestResultTable.TreeNode- Returns:
- True if this is the root node, false otherwise.
-
getEnclosingTable
Description copied from interface:TestResultTable.TreeNodeFind out what TestResultTable this node is part of.- Specified by:
getEnclosingTablein interfaceTestResultTable.TreeNode- Returns:
- The TRT instance which this node is contained.
-
isUpToDate
public boolean isUpToDate()Description copied from interface:TestResultTable.TreeNodeHas 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:
isUpToDatein interfaceTestResultTable.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:
getChildCountin interfaceTestResultTable.TreeNode- Returns:
- The number of immediate children this node has.
-
getChild
Description copied from interface:TestResultTable.TreeNodeGet 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:
getChildin interfaceTestResultTable.TreeNode- Parameters:
index- The location to retrieve.- Returns:
- Null if there are no children here or the specified index if out of range.
-
getTestResults
Description copied from interface:TestResultTable.TreeNodeGet any immediate children of this node which are test result objects.- Specified by:
getTestResultsin interfaceTestResultTable.TreeNode- Returns:
- List of TestResult objects in this node. null if none
-
getTreeNodes
Get only the children of this node which are branches.- Specified by:
getTreeNodesin interfaceTestResultTable.TreeNode- Returns:
- List of children nodes objects in this node. null if none.
-
getName
Description copied from interface:TestResultTable.TreeNodeThe name of this node, not including all the ancestors names. This does not return a URL to this node from the root.- Specified by:
getNamein interfaceTestResultTable.TreeNode- Returns:
- Immediate name of this node, not the full name.
- See Also:
-
isLeaf
public boolean isLeaf(int index) Description copied from interface:TestResultTable.TreeNodeIs 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:
isLeafin interfaceTestResultTable.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.TreeNodeGet the statistics for the state of tests under this node.- Specified by:
getChildStatusin interfaceTestResultTable.TreeNode- Returns:
- An array of length Status.NUM_STATES, positionally representing the number of tests under this node with that state.
-
getIndex
Description copied from interface:TestResultTable.TreeNodeSearch for a specific item in this node.- Specified by:
getIndexin interfaceTestResultTable.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
Description copied from interface:TestResultTable.TreeNodeFinds 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:
matchTestin interfaceTestResultTable.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:
-
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:
-