#ifndef TreeSearch__Node
#define TreeSearch__Node
#include "Pattern.h"
#include <utility>
namespace TreeSearch {
struct NodeDescriptor {
Link* link;
Pattern* parent;
UShort_t shift;
Bool_t mirrored;
UChar_t depth;
NodeDescriptor( Link* ln, Pattern* p, UShort_t shft, Bool_t mir,
UChar_t dep )
: link(ln), parent(p), shift(shft), mirrored(mir), depth(dep)
{ assert(ln && ln->GetPattern()); }
NodeDescriptor() {}
~NodeDescriptor() {}
UShort_t Start() const { return shift; }
UShort_t End() const { return (*this)[link->GetPattern()->GetNbits()-1];}
void Print() const;
UShort_t operator[](UInt_t i) const {
if( i == 0 ) return shift;
Pattern& pat = *(link->GetPattern());
if( mirrored ) return shift - pat[i];
else return shift + pat[i];
}
bool operator<( const NodeDescriptor& rhs ) const {
if( shift < rhs.shift ) return true;
if( shift > rhs.shift ) return false;
UInt_t nb = link->GetPattern()->GetNbits();
for( UInt_t i = 1; i < nb; ++i ) {
if( (*this)[i] < rhs[i] ) return true;
if( (*this)[i] > rhs[i] ) return false;
}
return false;
}
bool operator<=( const NodeDescriptor& rhs ) const {
if( shift < rhs.shift ) return true;
if( shift > rhs.shift ) return false;
UInt_t nb = link->GetPattern()->GetNbits();
for( UInt_t i = 1; i < nb; ++i ) {
if( (*this)[i] < rhs[i] ) return true;
if( (*this)[i] > rhs[i] ) return false;
}
return true;
}
bool operator>( const NodeDescriptor& rhs ) const {
return !operator<=(rhs);
}
bool operator>=( const NodeDescriptor& rhs ) const {
return !operator<(rhs);
}
bool operator==( const NodeDescriptor& rhs ) const {
return ( shift == rhs.shift && mirrored == rhs.mirrored &&
*(link->GetPattern()) == *(rhs.link->GetPattern()) );
}
bool operator!=( const NodeDescriptor& rhs ) const {
return !operator==(rhs);
}
};
class HitSet;
typedef std::pair<NodeDescriptor,HitSet> Node_t;
}
#endif
Last update: Tue Jul 7 19:26:19 2009
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.