Generated on Tue Dec 16 13:34:01 2008 for ell-3.0.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         
00173         static const std::string ID;
00174         
00175         S_RNAfe_SingleM(    const std::string& rnaSeqStr,
00176                             const std::string& rnaStructBracketNotStr);
00177         
00178         S_RNAfe_SingleM(    const RNAFreeEnergy& rna );
00179                 
00182         S_RNAfe_SingleM(    const S_RNAfe_SingleM& toCopy);
00183                         
00184         virtual ~S_RNAfe_SingleM();
00185         
00191         virtual const std::string& getID( void ) const;
00192 
00193 
00194     // abstract functions (State)
00195         virtual bool    operator== (const State& state2) const;
00196         virtual bool    operator!= (const State& state2) const;
00197             
00207         virtual bool    operator< (const State& rna2) const;
00208 
00209         
00213         virtual double      getEnergy() const;
00214         
00219         virtual unsigned int    getMinimalDistance(const State& state2) const;
00220         
00228         virtual S_RNAfe_SingleM* clone(State* toFill = NULL) const;
00229         
00232         virtual State* fromString(const std::string& stringRep) const;          
00233         
00238         virtual std::string toString() const;
00239         
00245         virtual std::string& toString( std::string & toFill ) const;
00246         
00247         
00250         virtual std::string getSequence() const;
00251         
00255         virtual std::string getStructure() const;
00256 
00257         virtual NeighborListPtr getNeighborList() const;
00258         
00259         virtual NeighborListPtr getRandomNeighborList() const;
00260         
00261         virtual State*  getRandomNeighbor(State* inPlaceNeigh = NULL) const;
00262 
00264         
00268         virtual CSequence compress(void) const ;
00269         
00275         virtual CSequence& compress(CSequence& toFill) const;
00276         
00285         virtual State* uncompress(const CSequence& cseq, State* toFill) const;
00286         
00292         virtual State* uncompress(const CSequence& cseq);
00293         
00294         
00295     };
00296 
00297 } // namespace ell
00298 
00299 #endif /*RNAFREEENERGYSINGLEMOVESTATE_HH_*/