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

📄 ppforestsz.h

📁 ViennaRNA-1.6.1
💻 H
字号:
/*
  Copyright by Matthias Hoechsmann (C) 2002
  =====================================                                   
  You may use, copy and distribute this file freely as long as you
  - do not change the file,
  - leave this copyright notice in the file,
  - do not make any profit with the distribution of this file
  - give credit where credit is due
  You are not allowed to copy or distribute this file otherwise
  The commercial usage and distribution of this file is prohibited
  Please report bugs and suggestions to <mhoechsm@TechFak.Uni-Bielefeld.DE>
*/

#ifndef _PPFORESTSZ_H
#define _PPFORESTSZ_H

#include <cassert>
#include <iostream>

#include "misc.h"
#include "types.h"

using namespace std;

template <class L>
class PPForestSZ
{	
 protected:
  Uint m_size;
  Uint *m_lml;         // postorder index of leftmost leaf descandant of the subtree rootet at T[i]
  L *m_lb;			   // labels of nodes in postorder
  bool *m_keyroot;	   // is node a keyroot

  void calcKeyroots();

 public:
  typedef Uint size_type;
  typedef L label_type;

  PPForestSZ() : m_size(0), m_lml(NULL), m_lb(NULL),m_keyroot(NULL) {};
  PPForestSZ(Uint nrOfNodes);
  PPForestSZ(const PPForestSZ<L> &ppf);
  ~PPForestSZ();

  inline size_type size() const {return m_size;};
  inline Uint lml(Ulong i) const {return m_lml[i];};
  inline L label(Ulong i) const {return m_lb[i];};
  inline bool keyroot(Ulong i) const {return m_keyroot[i];};

  Uint numKeyroots() const
  {
	  Uint count=0;
	  for(Uint i=0;i<m_size;i++)
	  {
		  if(m_keyroot[i])
			  count++;
	  }
	  return count;
  }
  void printParameters(const string &name) const    {		cout << name.c_str() << "# size: " << size() << endl;		cout << name.c_str() << "# keyroots: " << numKeyroots() << endl;    }};

#endif

⌨️ 快捷键说明

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