// NODE.CPP #ifndef __NODE_CPP #define __NODE_CPP #include "node.h" int Node::node_count = 0; Node::Node() { ++node_count; node_id = node_count; ptrLeft = NULL; ptrRight = NULL; } Node::Node( char *newstr ) { ++node_count; node_id = node_count; Data.Assign( newstr ); ptrLeft = NULL; ptrRight = NULL; } inline Node::~Node(){;} inline int Node::Node_Count( void ) const { return( node_count ); } inline int Node::Node_ID( void ) const { return( node_id ); } inline void Node::Print() const { Element::Print(); cout << " (Node " << Node_ID() << ")"; } Node *Node::Connect_Left_of( Node *Right ) { Node *Left = Right->ptrLeft; if( Right ) { ptrLeft = Left; Right->ptrLeft = this; ptrRight = Right; if( Left ) Left->ptrRight = this; return( this ); } else { ptrRight = NULL; return( NULL ); } } Node *Node::Connect_Right_of( Node *Left ) { Node *Right = Left->ptrRight; if( Left ) { ptrRight = Right; Left->ptrRight = this; ptrLeft = Left; if( Right ) Right->ptrLeft = this; return( this ); } else return( NULL ); } Node *Node::Disconnect() { Node *Left = ptrLeft; Node *Right = ptrRight; if( Left ) Left->ptrRight = Right; if( Right ) Right->ptrLeft = Left; return( this ); } inline Node *Node::Get_Left_Node() { return( ptrLeft ); } inline Node *Node::Get_Right_Node() { return( ptrRight ); } inline void Node::operator << ( char *str ) { Element::Data + str; } #endif // __NODE_CPP