mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 23:10:31 +03:00
beautify
This commit is contained in:
parent
20e3827ed2
commit
692d4c3f32
@ -48,8 +48,8 @@ Bitmap::Bitmap(size_t size, const std::vector<bool>& initializer)
|
||||
//! Create Bitmap of length size and initialise.
|
||||
Bitmap::Bitmap(size_t size)
|
||||
:m_bitmap(size, false)
|
||||
,m_firstGap(0)
|
||||
,m_numWordsCovered(0)
|
||||
,m_firstGap(0)
|
||||
,m_numWordsCovered(0)
|
||||
|
||||
{
|
||||
}
|
||||
@ -63,11 +63,11 @@ Bitmap::Bitmap(const Bitmap ©)
|
||||
}
|
||||
|
||||
Bitmap::Bitmap(const Bitmap ©, const Range &range)
|
||||
:m_bitmap(copy.m_bitmap)
|
||||
,m_firstGap(copy.m_firstGap)
|
||||
,m_numWordsCovered(copy.m_numWordsCovered)
|
||||
:m_bitmap(copy.m_bitmap)
|
||||
,m_firstGap(copy.m_firstGap)
|
||||
,m_numWordsCovered(copy.m_numWordsCovered)
|
||||
{
|
||||
SetValueNonOverlap(range);
|
||||
SetValueNonOverlap(range);
|
||||
}
|
||||
|
||||
// for unordered_set in stack
|
||||
|
@ -83,15 +83,15 @@ private:
|
||||
//! set value between 2 positions, inclusive
|
||||
void
|
||||
SetValueNonOverlap(Range const& range) {
|
||||
size_t startPos = range.GetStartPos();
|
||||
size_t endPos = range.GetEndPos();
|
||||
size_t startPos = range.GetStartPos();
|
||||
size_t endPos = range.GetEndPos();
|
||||
|
||||
for(size_t pos = startPos ; pos <= endPos ; pos++) {
|
||||
m_bitmap[pos] = true;
|
||||
}
|
||||
for(size_t pos = startPos ; pos <= endPos ; pos++) {
|
||||
m_bitmap[pos] = true;
|
||||
}
|
||||
|
||||
m_numWordsCovered += range.GetNumWordsCovered();
|
||||
UpdateFirstGap(startPos, endPos, true);
|
||||
m_numWordsCovered += range.GetNumWordsCovered();
|
||||
UpdateFirstGap(startPos, endPos, true);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -148,17 +148,15 @@ public:
|
||||
void SetValue( size_t pos, bool value ) {
|
||||
bool origValue = m_bitmap[pos];
|
||||
if (origValue == value) {
|
||||
// do nothing
|
||||
}
|
||||
else {
|
||||
m_bitmap[pos] = value;
|
||||
UpdateFirstGap(pos, pos, value);
|
||||
if (value) {
|
||||
++m_numWordsCovered;
|
||||
}
|
||||
else {
|
||||
--m_numWordsCovered;
|
||||
}
|
||||
// do nothing
|
||||
} else {
|
||||
m_bitmap[pos] = value;
|
||||
UpdateFirstGap(pos, pos, value);
|
||||
if (value) {
|
||||
++m_numWordsCovered;
|
||||
} else {
|
||||
--m_numWordsCovered;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ inline float CalcTranslationScore(const std::vector<float> &probVector,
|
||||
out << *this; \
|
||||
return out.str(); \
|
||||
} \
|
||||
|
||||
|
||||
//! delete and remove every element of a collection object such as set, list etc
|
||||
template<class COLL>
|
||||
void RemoveAllInColl(COLL &coll)
|
||||
|
Loading…
Reference in New Issue
Block a user