⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 treenode.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 2 页
字号:
  cname.concat(L"<");  cname.concat(TObject::name());  cname.concat(L">");    // return the name  //  return cname;}// ---------------------------------------------------------------------//// required debug methods////----------------------------------------------------------------------// method: debug//// arguments://  unichar* msg: (input) information msg//// return: a boolean value indicating status//// this method dumps the contents of an object to the console// template<class TObject>boolean TreeNode<TObject>::debug(const unichar* msg_a) const {  // declare temporary strings to hold class data  //  String output;  String value;  // dump the item  //  value.assign((long)item_d);  output.debugStr(name(), msg_a, L"item_d", value);  Console::put(output);    // dump the parent node  //  value.assign((long)parent_d);  output.debugStr(name(), msg_a, L"parent_d", value);  Console::put(output);      // dump the left child  //  value.assign((long)left_d);  output.debugStr(name(), msg_a, L"left_d", value);  Console::put(output);  // dump the right sibling  //  value.assign((long)right_d);  output.debugStr(name(), msg_a, L"right_d", value);  Console::put(output);    // exit gracefully  //   return true;}//------------------------------------------------------------------------//// required destructor/constructor(s)////-----------------------------------------------------------------------// method: destructor//// arguments: none//// return: none//template<class TObject>TreeNode<TObject>::~TreeNode() {  // free memory  //  clear();}// method: default constructor//// arguments: none//// return: none//template<class TObject>TreeNode<TObject>::TreeNode(TObject* item_a) {  // initialize the item  //  Node<TObject>::setItem(item_a);    // initialize the remaining member data  //  parent_d = (TreeNode<TObject>*)NULL;  left_d = (TreeNode<TObject>*)NULL;  right_d = (TreeNode<TObject>*)NULL;  degree_d = DEF_DEGREE;    }// method: copy constructor//// arguments://  const TreeNode<TObject>& copy_tnode: (input) the TreeNode to copy//// return: none//template<class TObject>TreeNode<TObject>::TreeNode(const TreeNode<TObject>& copy_tnode_a) {  // call the assign method to copy the TreeNode  //  assign(copy_tnode_a);}//------------------------------------------------------------------------//// required assign methods////-------------------------------------------------------------------------// method: assign//// arguments://  const TreeNode<TObject>& copy_tnode: (input) the TreeNode to copy//// return: a boolean value indicating status//// this method copies the contents of the input to this TreeNode//template<class TObject>boolean TreeNode<TObject>::assign(const TreeNode<TObject>& copy_tnode_a) {  // set the item  //  Node<TObject>::assign(copy_tnode_a);    // exit gracefully  //  return true;}//------------------------------------------------------------------------//// required equality methods////------------------------------------------------------------------------// method: eq//// arguments://  const TreeNode<TObject>& compare_tnode: (input) the TreeNode to compare//// return: a boolean value indicating status//// this method compares two TreeNodes for equivalence. two// TreeNodes are equivalent if all corresponding items are equivalent//template<class TObject>boolean TreeNode<TObject>::eq(const TreeNode<TObject>& compare_tnode_a) const {   // compare the item  //  if ((item_d == (TObject*)NULL) ^      (compare_tnode_a.item_d == (TObject*)NULL)) {    return false;      }  if ((item_d != (TObject*)NULL) &&      (compare_tnode_a.item_d != (TObject*)NULL)) {    if (!Node<TObject>::eq(compare_tnode_a)) {      return false;    }  }    // if we have reached this far then they must be the same  //  return true;}//-------------------------------------------------------------------------//// required memory management methods////-------------------------------------------------------------------------// method: clear//// arguments: //    Integral::CMODE cmode_a: (input) clear mode//  // return: a boolean value indicating status//// this method clears the contents of the list by the setting of cmode_a//template<class TObject>boolean TreeNode<TObject>::clear(Integral::CMODE cmode_a) {  // clear the item  //  if (!Node<TObject>::clear(cmode_a)) {    return false;  }    // clear the remaining member data  //  if (cmode_a != Integral::RETAIN) {      parent_d = (TreeNode<TObject>*)NULL;    left_d = (TreeNode<TObject>*)NULL;    right_d = (TreeNode<TObject>*)NULL;    degree_d = DEF_DEGREE;  }    // exit gracefully  //  return true;}//------------------------------------------------------------------------//// class-specific public methods://  tree node manipulation methods////------------------------------------------------------------------------// method: setLeftChild//// arguments: //   const TreeNode* arg: (input) left child //  // return: a boolean value indicating status//// this method sets the left child of the current node//template<class TObject>boolean TreeNode<TObject>::setLeftChild(const TreeNode<TObject>* arg_a) {  // set the left child  //  left_d = const_cast<TreeNode<TObject>* >(arg_a);  // exit gracefully  //  return true;}// method: setRightSibling//// arguments: //   const TreeNode* arg: (input) left child //  // return: a boolean value indicating status//// this method sets the right sibling of the current node//template<class TObject>boolean TreeNode<TObject>::setRightSibling(const TreeNode<TObject>* arg_a) {  // set the right sibling  //  right_d = const_cast<TreeNode<TObject>* >(arg_a);    // exit gracefully  //  return true;}// method: isAdjacent//// arguments: //   const TObject* : (input) object to look for//  // return: a boolean value indicating status//// this method determines if the object is adjacent to the current node//template<class TObject>boolean TreeNode<TObject>::isAdjacent(const TObject* obj_a) const {  // verify the input  //  if (obj_a == (TObject*)NULL) {    return Error::handle(name(), L"isAdjacent", Error::ARG, __FILE__, __LINE__);  }    // check the left child  //  if (left_d != (TreeNode<TObject>*)NULL) {    if (left_d->getItem()->eq(*obj_a)) {      return true;    }    // check the right siblings    //    TreeNode<TObject>* rnode = left_d->getRightSibling();    while (rnode != (TreeNode<TObject>*)NULL) {      if (rnode->getItem()->eq(*obj_a)) {	return true;      }      rnode = rnode->getRightSibling();    }  }  // if we reach this far then the object must not be adjacent  //  return false;}// method: isAdjacent//// arguments: //   const TObject* : (input) object to look for//  // return: a boolean value indicating status//// this method determines if the object is adjacent to the current node//template<class TObject>boolean TreeNode<TObject>::isAdjacent(const TreeNode<TObject>* node_a) const {  // verify the input  //  if (node_a == (TreeNode<TObject>*)NULL) {    return Error::handle(name(), L"isAdjacent", Error::ARG, __FILE__, __LINE__);  }    // check the left child  //  if (left_d != (TreeNode<TObject>*)NULL) {    if (left_d->eq(*node_a)) {      return true;    }    // check the right siblings    //    TreeNode<TObject>* rnode = left_d->getRightSibling();    while (rnode != (TreeNode<TObject>*)NULL) {      if (rnode->eq(*node_a)) {	return true;      }      rnode = rnode->getRightSibling();    }  }  // if we reach this far then the object must not be adjacent  //  return false;}// end of include file//#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -