src/ell/protein/S_LP_PullM.cc
Go to the documentation of this file.00001 #include "ell/State.hh"
00002 #include "ell/protein/S_LP_PullM.hh"
00003 #include <biu/LatticeProtein_Ipnt.hh>
00004 #include <biu/PullMoveSet.hh>
00005 #include <biu/LatticeDescriptorCUB.hh>
00006 #include <biu/assertbiu.hh>
00007
00008 namespace ell
00009 {
00010
00011 S_LP_PullM::S_LP_PullM( biu::LatticeProtein_I* _latProt,
00012 biu::LatticeMoveSet* _moveSet)
00013 : S_LP(_latProt, _moveSet)
00014 {}
00015
00016 S_LP_PullM::S_LP_PullM( const S_LP_PullM& s)
00017 : S_LP( s.latProt->clone(), s.moveSet->clone() )
00018 {}
00019
00020 S_LP_PullM::~S_LP_PullM()
00021 {}
00022
00023 State*
00024 S_LP_PullM::clone() const
00025 {
00026 assertbiu(latProt != NULL , "no lattice protein (NULL)");
00027 assertbiu(moveSet != NULL , "no move set (NULL)");
00028 return new S_LP_PullM(*this);
00029 }
00030
00031 State*
00032 S_LP_PullM::fromString(const std::string& stringRep) const {
00033 return new S_LP_PullM(this->latProt->fromString(stringRep),
00034 this->moveSet->clone());
00035 }
00036
00037
00038
00040
00041
00042
00043
00044 CSequence
00045 S_LP_PullM::compress(void) const {
00046 return latProt->getLatticeModel()->getDescriptor()->
00047 getAlphabet()->compress(latProt->getMoveSeqAbs());
00048 }
00049
00050
00051
00052
00053
00054
00055 CSequence&
00056 S_LP_PullM::compress(CSequence& toFill) const {
00057 toFill = latProt->getLatticeModel()->getDescriptor()->
00058 getAlphabet()->compress(latProt->getMoveSeqAbs());
00059 return toFill;
00060 }
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 State*
00071 S_LP_PullM::uncompress(const CSequence& cseq, State* toFill) const {
00072
00073 const std::string newSeq =
00074 latProt->getLatticeModel()->getString(
00075 latProt->getLatticeModel()->getDescriptor()->
00076 getAlphabet()->decompress(cseq, latProt->getLength()-1));
00077
00078 if (toFill==NULL) {
00079
00080 biu::LatticeProtein_I* newProt = latProt->clone();
00081 newProt->setMoveStrAbs(newSeq);
00082 toFill = new S_LP_PullM(newProt, moveSet->clone());
00083 }
00084 else
00085 {
00086 S_LP_PullM* s = dynamic_cast<S_LP_PullM*>(toFill);
00087 assertbiu(s != NULL, "casting to S_LP_PullM failed");
00088 s->latProt->setMoveStrAbs(newSeq);
00089 toFill = s;
00090 }
00091
00092 return toFill;
00093 }
00094
00095
00096
00097
00098
00099
00100 State*
00101 S_LP_PullM::uncompress(const CSequence& cseq) {
00102 return uncompress(cseq, this);
00103 }
00104
00105 }