STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Public Attributes | List of all members
cliext::impl::tree_node< _Key_t, _Value_t > Class Template Reference
Inheritance diagram for cliext::impl::tree_node< _Key_t, _Value_t >:

Public Types

typedef tree_node< _Key_t, _Value_t > _Mytype_t
 
typedef _STLCLR Generic::INode< _Value_t > _Mynode_it
 
typedef _STLCLR Generic::IBidirectionalContainer< _Value_t > _Mycont_it
 
typedef _Value_t value_type
 

Public Member Functions

 tree_node ()
 
 tree_node (_Mytype_t^_Larg, _Mytype_t^_Parg, _Mytype_t^_Rarg, _Mytype_t^_Harg, value_type _Val, signed char _Carg)
 
_Mycont_it container ()
 
bool is_head ()
 
_Mytype_t max_node ()
 
_Mytype_t min_node ()
 
_Mytype_t next_node ()
 
_Mytype_t prev_node ()
 

Public Attributes

property _Value_t _Value
 
_Mycont_it _Mycont
 
_Mytype_t _Head
 
_Mytype_t _Left
 
_Mytype_t _Parent
 
_Mytype_t _Right
 
value_type _Myval
 
signed char _Color
 

Member Typedef Documentation

template<typename _Key_t , typename _Value_t >
typedef _STLCLR Generic::IBidirectionalContainer<_Value_t> cliext::impl::tree_node< _Key_t, _Value_t >::_Mycont_it
template<typename _Key_t , typename _Value_t >
typedef _STLCLR Generic::INode<_Value_t> cliext::impl::tree_node< _Key_t, _Value_t >::_Mynode_it
template<typename _Key_t , typename _Value_t >
typedef tree_node<_Key_t, _Value_t> cliext::impl::tree_node< _Key_t, _Value_t >::_Mytype_t
template<typename _Key_t , typename _Value_t >
typedef _Value_t cliext::impl::tree_node< _Key_t, _Value_t >::value_type

Constructor & Destructor Documentation

template<typename _Key_t , typename _Value_t >
cliext::impl::tree_node< _Key_t, _Value_t >::tree_node ( )
inline
24  { // construct an empty node
25  }
template<typename _Key_t , typename _Value_t >
cliext::impl::tree_node< _Key_t, _Value_t >::tree_node ( _Mytype_t _Larg,
_Mytype_t _Parg,
_Mytype_t _Rarg,
_Mytype_t _Harg,
value_type  _Val,
signed char  _Carg 
)
inline
30  : _Left(_Larg), _Parent(_Parg), _Right(_Rarg),
31  _Head(_Harg), _Myval(_Val), _Color(_Carg),
32  _Mycont(nullptr)
33  { // construct a node with value
34  }
_Mytype_t _Right
Definition: xtree:129
signed char _Color
Definition: xtree:131
value_type _Myval
Definition: xtree:130
_Mytype_t _Parent
Definition: xtree:128
_Mytype_t _Head
Definition: xtree:126
_Mytype_t _Left
Definition: xtree:127
_Mycont_it _Mycont
Definition: xtree:125
_FwdIt const _Ty _Val
Definition: algorithm:1938

Member Function Documentation

template<typename _Key_t , typename _Value_t >
_Mycont_it cliext::impl::tree_node< _Key_t, _Value_t >::container ( )
inline
37  { // return owning container
38  return (_Head == nullptr ? nullptr : _Head->_Mycont);
39  }
_Mytype_t _Head
Definition: xtree:126
_Mycont_it _Mycont
Definition: xtree:125
template<typename _Key_t , typename _Value_t >
bool cliext::impl::tree_node< _Key_t, _Value_t >::is_head ( )
inline
42  { // test if head node
43  return (_Mycont != nullptr);
44  }
_Mycont_it _Mycont
Definition: xtree:125
template<typename _Key_t , typename _Value_t >
_Mytype_t cliext::impl::tree_node< _Key_t, _Value_t >::max_node ( )
inline
47  { // return rightmost node in subtree
48  _Mytype_t^ _Node = this;
49 
50  for (; !_Node->_Right->is_head(); )
51  _Node = _Node->_Right; // descend along right subtrees
52  return (_Node);
53  }
tree_node< _Key_t, _Value_t > _Mytype_t
Definition: xtree:18
return(_PAIR_TYPE(_FwdIt)(_First, _First))
template<typename _Key_t , typename _Value_t >
_Mytype_t cliext::impl::tree_node< _Key_t, _Value_t >::min_node ( )
inline
56  { // return leftmost node in subtree
57  _Mytype_t^ _Node = this;
58 
59  for (; !_Node->_Left->is_head(); )
60  _Node = _Node->_Left; // descend along left subtrees
61  return (_Node);
62  }
tree_node< _Key_t, _Value_t > _Mytype_t
Definition: xtree:18
return(_PAIR_TYPE(_FwdIt)(_First, _First))
template<typename _Key_t , typename _Value_t >
_Mytype_t cliext::impl::tree_node< _Key_t, _Value_t >::next_node ( )
inline
65  { // return successor node
66  if (this == _Head || _Head == nullptr)
67  throw gcnew System::InvalidOperationException();
68  else if (!_Right->is_head())
69  return (_Right->min_node());
70  else
71  { // climb looking for right subtree
72  _Mytype_t^ _Node = this;
73  _Mytype_t^ _Nextnode;
74 
75  for (; !(_Nextnode = _Node->_Parent)->is_head()
76  && _Node == _Nextnode->_Right; )
77  _Node = _Nextnode; // go up while right subtree exists
78 
79  return (_Nextnode); // go to parent (head if end())
80  }
81  }
_Mytype_t _Right
Definition: xtree:129
tree_node< _Key_t, _Value_t > _Mytype_t
Definition: xtree:18
_Mytype_t min_node()
Definition: xtree:55
_Mytype_t _Head
Definition: xtree:126
bool is_head()
Definition: xtree:41
template<typename _Key_t , typename _Value_t >
_Mytype_t cliext::impl::tree_node< _Key_t, _Value_t >::prev_node ( )
inline
84  { // return predecessor node
85  if (_Head == nullptr)
86  throw gcnew System::InvalidOperationException();
87 
88  if (is_head())
89  return(_Right); // go to rightmost
90  else if (!_Left->is_head())
91  return (_Left->max_node()); // go to largest on left
92  else
93  { // climb looking for left subtree
94  _Mytype_t^ _Node = this;
95  _Mytype_t^ _Nextnode;
96 
97  for (; !(_Nextnode = _Node->_Parent)->is_head()
98  && _Node == _Nextnode->_Left; )
99  _Node = _Nextnode; // go up while left subtree exists
100 
101  if (_Nextnode->is_head())
102  throw gcnew System::InvalidOperationException();
103  return (_Nextnode); // go to parent (if not head)
104  }
105  }
_Mytype_t _Right
Definition: xtree:129
tree_node< _Key_t, _Value_t > _Mytype_t
Definition: xtree:18
_Mytype_t _Head
Definition: xtree:126
_Mytype_t _Left
Definition: xtree:127
bool is_head()
Definition: xtree:41
_Mytype_t max_node()
Definition: xtree:46

Member Data Documentation

template<typename _Key_t , typename _Value_t >
signed char cliext::impl::tree_node< _Key_t, _Value_t >::_Color
template<typename _Key_t , typename _Value_t >
_Mytype_t cliext::impl::tree_node< _Key_t, _Value_t >::_Head
template<typename _Key_t , typename _Value_t >
_Mytype_t cliext::impl::tree_node< _Key_t, _Value_t >::_Left
template<typename _Key_t , typename _Value_t >
_Mycont_it cliext::impl::tree_node< _Key_t, _Value_t >::_Mycont
template<typename _Key_t , typename _Value_t >
value_type cliext::impl::tree_node< _Key_t, _Value_t >::_Myval
template<typename _Key_t , typename _Value_t >
_Mytype_t cliext::impl::tree_node< _Key_t, _Value_t >::_Parent
template<typename _Key_t , typename _Value_t >
_Mytype_t cliext::impl::tree_node< _Key_t, _Value_t >::_Right
template<typename _Key_t , typename _Value_t >
property _Value_t cliext::impl::tree_node< _Key_t, _Value_t >::_Value
Initial value:
{
virtual _Value_t% get()
{
if (this == _Head || _Head == nullptr)
throw gcnew System::InvalidOperationException();
return (_Myval);
}
virtual void set(_Value_t% _Val)
{
if (this == _Head || _Head == nullptr)
throw gcnew System::InvalidOperationException();
}
}

The documentation for this class was generated from the following file: