Generated on Mon Jun 23 17:17:53 2008 for ell-2.3.0 by doxygen 1.5.1

src/ell/rna/S_RNAfe_SingleM.hh

Go to the documentation of this file.
00001 #ifndef RNAFREEENERGYSINGLEMOVESTATE_HH_
00002 #define RNAFREEENERGYSINGLEMOVESTATE_HH_
00003 
00004 
00005 #include "ell/State.hh"
00006 #include "ell/rna/RNAFreeEnergy.hh"
00007 
00008 namespace ell
00009 {
00019     class S_RNAfe_SingleM : public State
00020     {
00021     protected:  
00022         typedef RNAFreeEnergy::SingleMove   SingleMove;
00023 
00024         class NeighborList : public State::NeighborList
00025         {
00026         protected:
00028             const S_RNAfe_SingleM* const origin;
00029 
00030         public:
00033             class ItState : public State::NeighborList::ItState
00034             {
00035             public:
00037                 SingleMove  lastMove;
00038 
00039                 ItState() : lastMove() {}
00040                 ItState(const ItState &itstate)
00041                  : lastMove(itstate.lastMove) {}
00042                 virtual ~ItState() {}
00043 
00044                 virtual ItState* clone() const {
00045                     return new ItState(*this);
00046                 }
00047             };
00048 
00049             NeighborList(const S_RNAfe_SingleM* _origin);
00050             
00051             virtual ~NeighborList();
00052 
00057             virtual State* first(State::NeighborList::ItState** itstate) const;
00058                          
00063             virtual State* next(    State::NeighborList::ItState* itstate, 
00064                                     State* elem) const;
00065         };
00066 
00067         class RandomNeighborList : public State::NeighborList
00068         {
00069         public:
00070             class ItState;
00071             
00072         protected:
00074             const S_RNAfe_SingleM* const origin;
00075 
00079             void    switchMode(ItState* itstate) const;
00080             
00081         public:
00082             class ItState : public State::NeighborList::ItState
00083             {
00084             public:
00089                 static const size_t SWITCH_MODE_THRESHOLD;
00090                 
00093                 size_t switchModeValue;
00094                 
00097                 std::set<SingleMove> chosenMoves;
00098                 
00101                 std::vector<SingleMove> unchosenValidMoves;
00102 
00103                 ItState() : switchModeValue(SWITCH_MODE_THRESHOLD),
00104                             chosenMoves(),
00105                             unchosenValidMoves()
00106                 {}
00107                 
00108                 ItState(const ItState &itstate) 
00109                     : switchModeValue(itstate.switchModeValue),
00110                       chosenMoves(itstate.chosenMoves),
00111                       unchosenValidMoves(itstate.unchosenValidMoves)
00112                 {}
00113                 
00114                 virtual ~ItState() 
00115                 {}
00116 
00117                 virtual ItState* clone() const {
00118                     return new ItState(*this);
00119                 }
00120             };
00121 
00122             RandomNeighborList(const S_RNAfe_SingleM* _origin);
00123             
00124             virtual ~RandomNeighborList();
00125 
00130             virtual State* first(State::NeighborList::ItState** itstate) const;
00131                          
00136             virtual State* next(    State::NeighborList::ItState* itstate, 
00137                                     State* elem) const;
00138         };
00139 
00140         RNAFreeEnergy rnaFreeEnergy;
00141 
00142         biu::Alphabet::AlphElem open;
00143         biu::Alphabet::AlphElem none;
00144         biu::Alphabet::AlphElem close;
00145 
00150         SingleMove  firstValidSingleMove() const;
00151         
00159         SingleMove nextValidSingleMove(const SingleMove lastSingleMove) const;
00160         
00167         SingleMove searchForNextValidSingleMove(size_t pos1,
00168                                             size_t pos2) const;
00169     
00170     public:
00171         S_RNAfe_SingleM(    const std::string& rnaSeqStr,
00172                             const std::string& rnaStructBracketNotStr);
00173         
00174         S_RNAfe_SingleM(    const RNAFreeEnergy& rna );
00175                 
00176         S_RNAfe_SingleM( 
00177                         const S_RNAfe_SingleM& rnaFESMS);
00178                         
00179         virtual ~S_RNAfe_SingleM();
00180 
00181     // abstract functions (State)
00182         virtual bool    operator== (const State& state2) const;
00183         virtual bool    operator!= (const State& state2) const;
00184 
00187         virtual int getFitness() const;
00188         
00190         virtual double      getEnergy() const;
00191         
00196         virtual unsigned int    getMinimalDistance(const State& state2) const;
00197         
00199         virtual S_RNAfe_SingleM*    clone() const;
00200         
00203         virtual State* fromString(const std::string& stringRep) const;          
00204         
00209         virtual std::string toString() const;
00210 
00211         virtual NeighborListPtr getNeighborList() const;
00212         
00213         virtual NeighborListPtr getRandomNeighborList() const;
00214         
00215         virtual State*  getRandomNeighbor(State* inPlaceNeigh = NULL) const;
00216 
00218         
00222         virtual CSequence compress(void) const ;
00223         
00229         virtual CSequence& compress(CSequence& toFill) const;
00230         
00239         virtual State* uncompress(const CSequence& cseq, State* toFill) const;
00240         
00246         virtual State* uncompress(const CSequence& cseq);
00247         
00248         
00249     };
00250 
00251 } // namespace ell
00252 
00253 #endif /*RNAFREEENERGYSINGLEMOVESTATE_HH_*/