Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

BinNode Class Reference

#include <BinNode.hpp>

List of all members.

Public Methods

 BinNode ()
 BinNode (DBase *e)
 BinNode (DBase *e, BinNode *l)
 BinNode (DBase *e, BinNode *l, BinNode *r)
virtual ~BinNode ()
BinNode * leftchild () const
BinNode * rightchild () const
DBasevalue ()
int CompareID (String &ID) const
int CompareID (DBase &db) const
void setValue (DBase &val)
bool isLeaf () const
bool valid () const
DBasegetElem ()
void * operator new (size_t)
void operator delete (void *)
void display () const

Public Attributes

BinNode * left
BinNode * right

Static Public Attributes

BinNode * freelist = NULL

Private Attributes

DBaseelement

Friends

ostream & operator<< (ostream &os, BinNode *node)


Constructor & Destructor Documentation

BinNode::BinNode   [inline]
 

Definition at line 8 of file BinNode.cpp.

00009 : element ( NULL ),
00010   left    ( NULL ),
00011   right   ( NULL ) { }

BinNode::BinNode DBase   e [inline]
 

Definition at line 14 of file BinNode.cpp.

00015 : element ( e    ),
00016   left    ( NULL ),
00017   right   ( NULL ) { }

BinNode::BinNode DBase   e,
BinNode *    l
[inline]
 

Definition at line 19 of file BinNode.cpp.

00020 : element ( e    ),
00021   left    ( l    ),
00022   right   ( NULL ) { }

BinNode::BinNode DBase   e,
BinNode *    l,
BinNode *    r
[inline]
 

Definition at line 25 of file BinNode.cpp.

00026 : element ( e ), 
00027   left    ( l ),  
00028   right   ( r ) { }

BinNode::~BinNode   [virtual]
 

Definition at line 30 of file BinNode.cpp.

00030 { }


Member Function Documentation

int BinNode::CompareID DBase   db const [inline]
 

Definition at line 57 of file BinNode.cpp.

00058 {
00059   return CompareID( *db._id );
00060 }

int BinNode::CompareID String   ID const
 

Definition at line 32 of file BinNode.cpp.

Referenced by BinSearchTree::find(), and BinSearchTree::findID().

00033 {
00034   if ( this == NULL ) 
00035   {
00036     cout << "The Node is NULL" << endl;
00037     return 1000;
00038   }
00039 
00040   if ( element != NULL ) 
00041   {
00042     if ( element->_id != NULL ) 
00043     {
00044       return -1 *( element->_id->compare( ID ) );
00045     } 
00046     else 
00047     {
00048       return -50;
00049     }
00050   } 
00051   else 
00052   {
00053     return -100;
00054   }
00055 }

void BinNode::display   const [inline]
 

Definition at line 46 of file BinNode.hpp.

00047 {                                   // on the Screen.
00048     cout << element->string() << endl;
00049 }

DBase * BinNode::getElem  
 

Definition at line 89 of file BinNode.cpp.

Referenced by BinSearchTree::find(), and BinSearchTree::findID().

00090 {
00091   if ( this == NULL ) 
00092   {
00093     cout << "The Node is NULL" << endl;
00094     return NULL;
00095   }
00096   
00097   return element; 
00098 }

bool BinNode::isLeaf   const [inline]
 

Definition at line 105 of file BinNode.cpp.

Referenced by do_commands(), and output_tree().

00106 {
00107   return (left == NULL) && (right == NULL); 
00108 }

BinNode * BinNode::leftchild   const [inline]
 

Definition at line 62 of file BinNode.cpp.

Referenced by do_commands(), and output_tree().

00063 {
00064     return left; 
00065 }

void BinNode::operator delete void *    ptr
 

Definition at line 120 of file BinNode.cpp.

00121 {
00122   ((BinNode*)ptr)->left = freelist;
00123   freelist = (BinNode*)ptr;
00124 }

void * BinNode::operator new size_t   
 

Definition at line 110 of file BinNode.cpp.

00111 {
00112   if (freelist == NULL) 
00113     return(::new BinNode);
00114 
00115   BinNode* temp = freelist;
00116   freelist = freelist->left;
00117   return temp;
00118 }

BinNode * BinNode::rightchild   const [inline]
 

Definition at line 67 of file BinNode.cpp.

Referenced by do_commands(), and output_tree().

00068 {
00069     return right; 
00070 }

void BinNode::setValue DBase   val [inline]
 

Definition at line 100 of file BinNode.cpp.

Referenced by BinSearchTree::remove().

00101 { 
00102   element = new DBase( val ); 
00103 }

bool BinNode::valid   const [inline]
 

Definition at line 72 of file BinNode.cpp.

00073 {
00074   return ( element != NULL );
00075 }

DBase & BinNode::value  
 

Definition at line 77 of file BinNode.cpp.

Referenced by do_commands(), BinSearchTree::insert(), operator<<(), output_tree(), BinSearchTree::preorder(), BinSearchTree::print(), BinSearchTree::remove(), and HuffTree::weight().

00078 { 
00079   if ( this == NULL ) 
00080   {
00081     DBase* temp = new DBase();
00082     cout << "The Node is NULL" << endl;
00083     return *temp;
00084   }
00085   
00086   return *element; 
00087 }


Friends And Related Function Documentation

ostream& operator<< ostream &    os,
BinNode *    node
[friend]
 

Definition at line 51 of file BinNode.hpp.

00051                                                               { 
00052   return os << node->element->string() << endl;
00053 }


Member Data Documentation

DBase* BinNode::element [private]
 

Definition at line 57 of file BinNode.hpp.

Referenced by operator<<().

BinNode * BinNode::freelist = NULL [static]
 

Definition at line 18 of file HuffBin.hpp.

BinNode* BinNode::left
 

Definition at line 42 of file BinNode.hpp.

Referenced by BinSearchTree::deletemin(), BinSearchTree::find(), BinSearchTree::findID(), freelist(), BinSearchTree::insert(), operator new(), BinSearchTree::preorder(), BinSearchTree::print(), and BinSearchTree::remove().

BinNode* BinNode::right
 

Definition at line 43 of file BinNode.hpp.

Referenced by BinSearchTree::deletemin(), BinSearchTree::find(), BinSearchTree::findID(), BinSearchTree::insert(), BinSearchTree::preorder(), BinSearchTree::print(), and BinSearchTree::remove().


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:48:26 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001