Class SCPTreeRecord
- All Implemented Interfaces:
Comparable
,TreeNode
Instances of the SCPTreeRecord
class represent
nodes in a tree of the SCPTree
class, which in
turn is used by the SCPTreeBrowser
class.
Each record represents a single name-value pair, with the value potentially empty (e.g. a container).
-
Constructor Summary
ConstructorsConstructorDescriptionSCPTreeRecord
(SCPTreeRecord parent, int iname) Construct a record for a named container, linking to the specied parent.SCPTreeRecord
(SCPTreeRecord parent, int iname, String value) Construct a record for a name-value pair linking to the specified parent.SCPTreeRecord
(SCPTreeRecord parent, String name) Construct a record for a named container, linking to the specied parent.SCPTreeRecord
(SCPTreeRecord parent, String name, String value) Construct a record for a name-value pair linking to the specified parent. -
Method Summary
Modifier and TypeMethodDescriptionchildren()
Returns the children of this node as anEnumeration
.int
boolean
boolean
Always returns true, since children may always be added.getChildAt
(int index) Returns the child at the specified index.int
Return the number of children that this node contains.int
Returns the index of the specified child from amongst this node's children, if present.Returns the parent node of this node.boolean
isLeaf()
Returns true if the receiver is a leaf (has no children).toString()
Dump the record as a string.
-
Constructor Details
-
SCPTreeRecord
Construct a record for a name-value pair linking to the specified parent.
Adds the new node to the children of the parent node, keeping them sorted.
- Parameters:
parent
- parent recordname
- theString
name of this node (by which they are sorted)value
- theString
value of this node
-
SCPTreeRecord
Construct a record for a named container, linking to the specied parent.
Adds the new node to the children of the parent node, keeping them sorted.
- Parameters:
parent
- parent recordname
- theString
name of this node (by which they are sorted)
-
SCPTreeRecord
Construct a record for a name-value pair linking to the specified parent.
Adds the new node to the children of the parent node, keeping them sorted.
- Parameters:
parent
- parent recordiname
- the numeric name of this node (by which they are sorted)value
- theString
value of this node
-
SCPTreeRecord
Construct a record for a named container, linking to the specied parent.
Adds the new node to the children of the parent node, keeping them sorted.
- Parameters:
parent
- parent recordiname
- the numeric name of this node (by which they are sorted)
-
-
Method Details
-
toString
Dump the record as a string.
-
compareTo
- Specified by:
compareTo
in interfaceComparable
- Parameters:
o
-
-
equals
-
getParent
Returns the parent node of this node.
-
getChildAt
Returns the child at the specified index.
- Specified by:
getChildAt
in interfaceTreeNode
- Parameters:
index
- the index of the child to be returned, numbered from 0- Returns:
- the child
TreeNode
at the specified index
-
getIndex
Returns the index of the specified child from amongst this node's children, if present.
-
getAllowsChildren
public boolean getAllowsChildren()Always returns true, since children may always be added.
- Specified by:
getAllowsChildren
in interfaceTreeNode
- Returns:
- always true
-
isLeaf
public boolean isLeaf()Returns true if the receiver is a leaf (has no children).
-
getChildCount
public int getChildCount()Return the number of children that this node contains.
- Specified by:
getChildCount
in interfaceTreeNode
- Returns:
- the number of children, 0 if none
-
children
Returns the children of this node as an
Enumeration
.
-