Generated on Mon Jun 23 16:24:56 2008 for BIU-1.7.0 by doxygen 1.5.1

src/biu/ContactEnergyFunction.cc

Go to the documentation of this file.
00001 #include "biu/ContactEnergyFunction.hh"
00002 #include "biu/assertbiu.hh"
00003 
00004 namespace biu
00005 {
00006 
00007     ContactEnergyFunction::ContactEnergyFunction(
00008                 const Alphabet* const _alphabet, 
00009                 const EnergyMatrix* const _energyMat) 
00010         : alphabet(_alphabet), energyMat(_energyMat)
00011     {
00012         assertbiu(  alphabet->getAlphabetSize() == energyMat->numRows() 
00013                 && alphabet->getAlphabetSize() == energyMat->numColumns(),
00014                 "energy matrix has the wrong size for this alphabet size");
00015     }
00016     
00017     ContactEnergyFunction::~ContactEnergyFunction()
00018     {
00019     }
00020     
00021     double 
00022     ContactEnergyFunction::getContactEnergy( 
00023                             const Alphabet::AlphElem& first, 
00024                             const Alphabet::AlphElem& second) const {
00025         
00026     return (*energyMat)[alphabet->getIndex(first)][alphabet->getIndex(second)];
00027     }
00028     
00029     
00030     bool 
00031     ContactEnergyFunction::operator == (const ContactEnergyFunction& cef2) const {
00032         if (this == &cef2)
00033             return true;
00034         return  *alphabet == *(cef2.alphabet)
00035                 && *energyMat == *(energyMat);
00036     }
00037     
00038     bool 
00039     ContactEnergyFunction::operator != (const ContactEnergyFunction& cef2) const {
00040         return  !(this->operator ==(cef2));
00041     }
00042     
00043 
00044 } // namespace biu