本文整理汇总了C++中PWPath::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ PWPath::Clear方法的具体用法?C++ PWPath::Clear怎么用?C++ PWPath::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PWPath
的用法示例。
在下文中一共展示了PWPath::Clear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AllDeletes
static void AllDeletes(PWPath &Path, unsigned uLengthA)
{
Path.Clear();
PWEdge Edge;
Edge.cType = 'D';
Edge.uPrefixLengthB = 0;
for (unsigned uPrefixLengthA = 1; uPrefixLengthA <= uLengthA; ++uPrefixLengthA)
{
Edge.uPrefixLengthA = uPrefixLengthA;
Path.AppendEdge(Edge);
}
}
示例2: AllInserts
static void AllInserts(PWPath &Path, unsigned uLengthB)
{
Path.Clear();
PWEdge Edge;
Edge.cType = 'I';
Edge.uPrefixLengthA = 0;
for (unsigned uPrefixLengthB = 1; uPrefixLengthB <= uLengthB; ++uPrefixLengthB)
{
Edge.uPrefixLengthB = uPrefixLengthB;
Path.AppendEdge(Edge);
}
}
示例3: DiagToPath
static void DiagToPath(const Diag &d, PWPath &Path)
{
Path.Clear();
const unsigned uLength = d.m_uLength;
for (unsigned i = 0; i < uLength; ++i)
{
PWEdge Edge;
Edge.cType = 'M';
Edge.uPrefixLengthA = d.m_uStartPosA + i + 1;
Edge.uPrefixLengthB = d.m_uStartPosB + i + 1;
Path.AppendEdge(Edge);
}
}
示例4: TraceBack
SCORE TraceBack(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
unsigned uLengthB, const SCORE *DPM_, const SCORE *DPD_, const SCORE *DPI_,
PWPath &Path)
{
#if TRACE
Log("\n");
Log("TraceBack LengthA=%u LengthB=%u\n", uLengthA, uLengthB);
#endif
assert(uLengthB > 0 && uLengthA > 0);
const unsigned uPrefixCountA = uLengthA + 1;
const unsigned uPrefixCountB = uLengthB + 1;
Path.Clear();
unsigned uPrefixLengthA = uLengthA;
unsigned uPrefixLengthB = uLengthB;
const SCORE scoreM = DPM(uPrefixLengthA, uPrefixLengthB);
SCORE scoreD = DPD(uPrefixLengthA, uPrefixLengthB);
SCORE scoreI = DPI(uPrefixLengthA, uPrefixLengthB);
const ProfPos &LastPPA = PA[uLengthA - 1];
const ProfPos &LastPPB = PB[uLengthB - 1];
scoreD += LastPPA.m_scoreGapClose;
scoreI += LastPPB.m_scoreGapClose;
char cEdgeType = cInsane;
SCORE scoreMax;
if (scoreM >= scoreD && scoreM >= scoreI)
{
scoreMax = scoreM;
cEdgeType = 'M';
}
else if (scoreD >= scoreM && scoreD >= scoreI)
{
scoreMax = scoreD;
cEdgeType = 'D';
}
else
{
assert(scoreI >= scoreM && scoreI >= scoreD);
scoreMax = scoreI;
cEdgeType = 'I';
}
for (;;)
{
if ('S' == cEdgeType)
break;
PWEdge Edge;
Edge.cType = cEdgeType;
Edge.uPrefixLengthA = uPrefixLengthA;
Edge.uPrefixLengthB = uPrefixLengthB;
Path.PrependEdge(Edge);
char cPrevEdgeType;
unsigned uPrevPrefixLengthA = uPrefixLengthA;
unsigned uPrevPrefixLengthB = uPrefixLengthB;
switch (cEdgeType)
{
case 'M':
{
assert(uPrefixLengthA > 0);
assert(uPrefixLengthB > 0);
const ProfPos &PPA = PA[uPrefixLengthA - 1];
const ProfPos &PPB = PB[uPrefixLengthB - 1];
const SCORE Score = DPM(uPrefixLengthA, uPrefixLengthB);
const SCORE scoreMatch = ScoreProfPos2(PPA, PPB);
SCORE scoreSM;
if (1 == uPrefixLengthA && 1 == uPrefixLengthB)
scoreSM = scoreMatch;
else
scoreSM = MINUS_INFINITY;
SCORE scoreMM = MINUS_INFINITY;
SCORE scoreDM = MINUS_INFINITY;
SCORE scoreIM = MINUS_INFINITY;
if (uPrefixLengthA > 1 && uPrefixLengthB > 1)
scoreMM = DPM(uPrefixLengthA-1, uPrefixLengthB-1) + scoreMatch;
if (uPrefixLengthA > 1)
{
SCORE scoreTransDM = PA[uPrefixLengthA-2].m_scoreGapClose;
scoreDM = DPD(uPrefixLengthA-1, uPrefixLengthB-1) + scoreTransDM + scoreMatch;
}
if (uPrefixLengthB > 1)
{
SCORE scoreTransIM = PB[uPrefixLengthB-2].m_scoreGapClose;
scoreIM = DPI(uPrefixLengthA-1, uPrefixLengthB-1) + scoreTransIM + scoreMatch;
}
if (EQ(scoreMM, Score))
cPrevEdgeType = 'M';
else if (EQ(scoreDM, Score))
cPrevEdgeType = 'D';
//.........这里部分代码省略.........
示例5: NWDASimple
//.........这里部分代码省略.........
Log("DA Simple DPM:\n");
ListDP(DPM_, PA, PB, uPrefixCountA, uPrefixCountB);
Log("\n");
Log("DA Simple DPD:\n");
ListDP(DPD_, PA, PB, uPrefixCountA, uPrefixCountB);
Log("\n");
Log("DA Simple DPE:\n");
ListDP(DPE_, PA, PB, uPrefixCountA, uPrefixCountB);
Log("\n");
Log("DA Simple DPI:\n");
ListDP(DPI_, PA, PB, uPrefixCountA, uPrefixCountB);
Log("\n");
Log("DA Simple DPJ:\n");
ListDP(DPJ_, PA, PB, uPrefixCountA, uPrefixCountB);
Log("\n");
Log("DA Simple TBM:\n");
ListTB(TBM_, PA, PB, uPrefixCountA, uPrefixCountB);
Log("\n");
Log("DA Simple TBD:\n");
ListTB(TBD_, PA, PB, uPrefixCountA, uPrefixCountB);
Log("\n");
Log("DA Simple TBE:\n");
ListTB(TBE_, PA, PB, uPrefixCountA, uPrefixCountB);
Log("\n");
Log("DA Simple TBI:\n");
ListTB(TBI_, PA, PB, uPrefixCountA, uPrefixCountB);
Log("\n");
Log("DA Simple TBJ:\n");
ListTB(TBJ_, PA, PB, uPrefixCountA, uPrefixCountB);
#endif
// Trace-back
// ==========
Path.Clear();
// Find last edge
SCORE M = DPM(uLengthA, uLengthB);
SCORE D = DPD(uLengthA, uLengthB) + PA[uLengthA-1].m_scoreGapClose;
SCORE E = DPE(uLengthA, uLengthB) + PA[uLengthA-1].m_scoreGapClose2;
SCORE I = DPI(uLengthA, uLengthB) + PB[uLengthB-1].m_scoreGapClose;
SCORE J = DPJ(uLengthA, uLengthB) + PB[uLengthB-1].m_scoreGapClose2;
char cEdgeType = '?';
SCORE BestScore = M;
cEdgeType = 'M';
if (D > BestScore)
{
cEdgeType = 'D';
BestScore = D;
}
if (E > BestScore)
{
cEdgeType = 'E';
BestScore = E;
}
if (I > BestScore)
{
cEdgeType = 'I';
BestScore = I;
}
if (J > BestScore)
{
cEdgeType = 'J';
BestScore = J;
}
示例6: EstringsToPath
void EstringsToPath(const short esA[], const short esB[], PWPath &Path)
{
Path.Clear();
unsigned iA = 0;
unsigned iB = 0;
int nA = esA[iA++];
int nB = esB[iB++];
unsigned uPrefixLengthA = 0;
unsigned uPrefixLengthB = 0;
for (;;)
{
char cType;
if (nA > 0)
{
if (nB > 0)
{
cType = 'M';
--nA;
--nB;
}
else if (nB < 0)
{
cType = 'D';
--nA;
++nB;
}
else
assert(false);
}
else if (nA < 0)
{
if (nB > 0)
{
cType = 'I';
++nA;
--nB;
}
else
assert(false);
}
else
assert(false);
switch (cType)
{
case 'M':
++uPrefixLengthA;
++uPrefixLengthB;
break;
case 'D':
++uPrefixLengthA;
break;
case 'I':
++uPrefixLengthB;
break;
}
PWEdge Edge;
Edge.cType = cType;
Edge.uPrefixLengthA = uPrefixLengthA;
Edge.uPrefixLengthB = uPrefixLengthB;
Path.AppendEdge(Edge);
if (nA == 0)
{
if (0 == esA[iA])
{
assert(0 == esB[iB]);
break;
}
nA = esA[iA++];
}
if (nB == 0)
nB = esB[iB++];
}
}