home *** CD-ROM | disk | FTP | other *** search
- .TH D_NODE
- .SH NAME
- D_Node<Type,nchild>\f1 Parameterized, dynamic-size n-ary node class
- .SH SYNOPSIS
- #include <cool/D_Node.h>
- .SH DESCRIPTION
- The \f3D_Node<Type,nchild>\f1 class implements parameterized nodes of a dynamic size
- for n-ary trees. This node class is parameterized for the type and some initial
- number of subtrees that each node may have. The \f3D_Node<Type,nchild> \f1class is
- dynamic in the sense that the number of subtrees allowed for each node is not
- fixed. \f3D_Node<Type,nchild>\f1 uses the \f3Vector<Type>\f1 class, which supports run-time
- growth characteristics. As a result, the \f3D_Node<Type,nchild>\f1 class should be
- used as the node type for the \f3N_Tree<Node,Type,nchild>\f1 class when the number of
- subtrees is variable, unknown at compile time, or needs to increase on a
- per-node basis at run-time. This capability is suited for hierarchical trees
- such as may be used in an organization chart. Also, specialization of the
- \f3N_Tree<Node,Type,nchild>\f1 class would allow for relatively easy implementation
- of a DAG class.
- .SH Base Classes
- None
- .SH Friend Classes
- \f3N_Tree<Node,Type,nchild>
- .SH Public Constructors
- .TP
- \f3D_Node<Type,nchild> \f3();\f1
- Allocates a D-node and a vector of subtree pointers of the initial size, all of
- which are set to
-
- NULL .
- .TP
- \f3D_Node<Type,nchild> \f3(const Type& value\f3);\f1
- Allocates a D-node and a vector of subtree pointers of the initial size, all of
- which are set to
-
- NULL ,
- and initializes the value of the node to
- value .
- .TP
- \f3D_Node<Type,nchild> (const D_Node<Type,nchild>& dn\f3);\f1
- Duplicates the value of another D-node object
- dn .
- .SH Member Functions
- .TP
- inline Type& get () const;
- Returns a reference to the value of the data member.
- .TP
- \f3Boolean insert_after (D_Node<Type,nchild>& dn\f3, int \f2index\f3);\f1
- Inserts a subtree pointer to
- dn
- after the zero-relative
- index .
- This function
- returns
-
- TRUE
- if successful; otherwise, this function returns
-
- FALSE .
- If
- index
- is negative or out of range, an
- \f3\f3Error\f1\f1
- exception is raised.
- .TP
- \f3Boolean insert_before (D_Node<Type,nchild>& dn\f3, int \f2index);\f1
- Inserts a subtree pointer to
- dn
- before the zero-relative
- index .
- This function
- returns
-
- TRUE
- if successful; otherwise, this function returns
-
- FALSE .
- If
- index
- is
- negative or out of range, an
- \f3\f3Error\f1\f1
- exception is raised.
- .TP
- Boolean is_leaf () const;
- Determines if the node is a terminal node by evaluating the subtree pointers.
- If all pointers are
-
- NULL ,
- this function returns
-
- TRUE ;
- otherwise, this function
- returns
-
- FALSE .
- .TP
- inline int num_subtrees () const;
- Returns the number of subtrees for a node.
- .TP
- \f3D_Node<Type,nchild>& \f3operator= (D_Node<Type,nchild>& dn\f3);\f1
- Overloads the assignment operator for the class to assign the values of the
- subtree pointers and the value in
- dn
- to the node object. This function returns
- a reference to the updated node.
- .TP
- \f3inline Boolean operator== (const Type& value\f3) const;\f1
- Overloads the equality operator for the \f3D_Node<Type>\f1 class. This function
- returns
-
- TRUE
- if
- value
- is equal to the value of the node object; otherwise, this
- function returns
-
- FALSE .
- .TP
- \f3inline Boolean operator!= (const Type& value\f3) const;\f1
- Overloads the inequality operator for the \f3D_Node<Type>\f1 class. This function
- returns
-
- TRUE
- if
- value
- is not equal to the value of the node object; otherwise,
- this function returns
-
- FALSE .
- .TP
- \f3inline Boolean operator< (const Type& value\f3) const;\f1
- Overloads the less-than operator for the \f3D_Node<Type>\f1 class. This function
- returns
-
- TRUE
- if
- value
- is less than the value of the node object; otherwise,
- this function returns
-
- FALSE .
- .TP
- \f3inline Boolean operator<= (const Type& value\f3) const;\f1
- Overloads the less-than-or-equal operator for the \f3D_Node<Type>\f1 class. This
- function returns
-
- TRUE
- if
- value
- is less than or equal to the value of the node
- object; otherwise, this function returns
-
- FALSE .
- .TP
- \f3inline Boolean operator> (const Type& value\f3) const;\f1
- Overloads the greater-than operator for the \f3D_Node<Type>\f1 class. This function
- returns
-
- TRUE
- if
- value
- is greater than the value of the node object; otherwise,
- this function returns
-
- FALSE .
- .TP
- \f3inline Boolean operator>= (const Type& value\f3) const;\f1
- Overloads the greater-than-or-equal operator for the \f3D_Node<Type>\f1 class. This
- function returns
-
- TRUE
- if
- value
- is greater than or equal to the value of the
- node object; otherwise, this function returns
-
- FALSE .
- .TP
- \f3inline D_Node<Type,nchild>*& \f3operator[\^] (int \f2index\f3);\f1
- Returns a reference to a pointer to the subtree at the zero-relative
- index .
- If
- index
- is negative or out of range, an
- \f3\f3Error\f1\f1
- exception is raised.
- .TP
- \f3inline void set (const Type& value\f3);\f1
- Sets the value of the data member in the node to
- value .
- .TP
- \f3inline void set_compare (\f2D_Node_Compare \f3= NULL);\f1
- Sets the comparison function that is to be used in all comparison tests.
- D_Node_Compare
- is a function of type
- Boolean
- (\f2*Function\f1)(\f3const Type&\f1, \f3const Type&\f1). If no argument is provided, the
- operator==
- for the type over which the
- class is parameterized is used.
- .SH COPYRIGHT
-
- Copyright (C) 1991 Texas Instruments Incorporated.
-
- Permission is granted to any individual or institution to use, copy, modify,
- and distribute this software, provided that this complete copyright and
- permission notice is maintained, intact, in all copies and supporting
- documentation.
-
- Texas Instruments Incorporated provides this software "as is" without
- express or implied warranty.
-
-