Package com.sun.interview
Interface TreeQuestion.Model
-
- Enclosing class:
- TreeQuestion
public static interface TreeQuestion.Model
An interface that provides the model for the tree whose nodes are selected by a TreeQuestion.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
getChild(java.lang.Object node, int index)
Get a child of a specified node, or null if no such child exists.int
getChildCount(java.lang.Object node)
Get the number of children of a specified node.java.lang.String
getName(java.lang.Object node)
Get the name of a specified node.java.lang.String
getPath(java.lang.Object node)
Get the full path from the root node of a specified node.java.lang.Object
getRoot()
Get the root node of the tree.boolean
isLeaf(java.lang.Object node)
Determine if this a node is a leaf node.
-
-
-
Method Detail
-
getRoot
java.lang.Object getRoot()
Get the root node of the tree.- Returns:
- the root node of the tree.
-
getChildCount
int getChildCount(java.lang.Object node)
Get the number of children of a specified node.- Parameters:
node
- the node for which to get the number of children- Returns:
- the number of children of the specified node
-
getChild
java.lang.Object getChild(java.lang.Object node, int index)
Get a child of a specified node, or null if no such child exists.- Parameters:
node
- the node for which to get the childindex
- the index of the child; this should be a number greater than or equal to zero and less than the number of children of the node.- Returns:
- the specified child, or null if index does not identify a valid child.
- See Also:
getChildCount(java.lang.Object)
-
getName
java.lang.String getName(java.lang.Object node)
Get the name of a specified node. The name will be used to construct paths. At a minimum, it should not contain '/'.- Parameters:
node
- the node whose name is required- Returns:
- the name of the specified node
-
getPath
java.lang.String getPath(java.lang.Object node)
Get the full path from the root node of a specified node.- Parameters:
node
- the node whose path is required- Returns:
- the path of the specified node from the root node, as composed from the names of this node and its ancestors, using '/' to separate the individual names.
-
isLeaf
boolean isLeaf(java.lang.Object node)
Determine if this a node is a leaf node. This is primarily an attribute of the node's actual type, and is not necessarily the same as having zero children. (A leaf node implies zero children, but zero children does not imply a node is a leaf.)- Parameters:
node
- the node to check for being a leaf- Returns:
- true if the specified node is a leaf node, and false otherwise.
-
-