/* Copyright by Matthias Hoechsmann (C) 2002-2004 ===================================== 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 */ #ifndef _PPFOREST_BASE_H #define _PPFOREST_BASE_H #include #include #include "misc.h" #include "types.h" using namespace std; /** PPForestBase is the base class of the template class PPForest. * To reduce the size of compiled programs functions and variables that are * independent of the labelling are implemented in this class. */ class PPForestBase { //template //friend class Alignment; public: typedef Uint size_type; private: bool m_isSumUpCSFValid; bool m_isRMBValid; size_type getNumRightBrothers(size_type i) const; size_type countLeaves(size_type i,size_type k) const; protected: size_type m_size; /**< size is the number of nodes of a tree */ size_type *m_rb; /**< m_rb[i] stores the preorder index of the rightbrother node of the ith node, or 0 if there is none. */ size_type *m_noc; /**< m_noc[i] stores the number of children of the ith node */ size_type *m_sumUpCSF; /**< m_sumUpCSF[i] stores the sum of non empty closed subforests of nodes k=i && i2<=max_node) return false; if(rb(i2,j2-1)>=i && rb(i2,j2-1)<=max_node) return false; // (i,j) included in (i2,j2) max_node=getRightmostBrotherIndex(i2); if(noc(max_node)) max_node=getRightmostBrotherIndex(max_node+1); if(i>=i2 && i<=max_node) return false; if(rb(i,j-1)>=i2 && rb(i,j-1)<=max_node) return false; return true; } }; #endif