diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-26 12:20:08 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-26 12:20:08 +0300 |
commit | 52f4086dbc5b5621600d07c3edf9dbca2e8cd38e (patch) | |
tree | ee6594d8438364e6e2663eda02bbc6153b13d700 /moses/Bitmap.h | |
parent | 486990fa3f8ed3150fe40f33f81c3c5ee2ccdd47 (diff) |
move m_bitmaps into Search class. Cube pruning uses it too
Diffstat (limited to 'moses/Bitmap.h')
-rw-r--r-- | moses/Bitmap.h | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/moses/Bitmap.h b/moses/Bitmap.h index 178845185..904024e62 100644 --- a/moses/Bitmap.h +++ b/moses/Bitmap.h @@ -79,6 +79,17 @@ private: } } + //! set value between 2 positions, inclusive + void + SetValue(Range const& range, bool value) { + size_t startPos = range.GetStartPos(); + size_t endPos = range.GetEndPos(); + + for(size_t pos = startPos ; pos <= endPos ; pos++) { + m_bitmap[pos] = value; + } + UpdateFirstGap(startPos, endPos, value); + } public: //! Create Bitmap of length size, and initialise with vector. @@ -107,6 +118,8 @@ public: :m_bitmap(copy.m_bitmap), m_firstGap(copy.m_firstGap) { } + Bitmap(const Bitmap ©, const Range &range); + //! Count of words translated. size_t GetNumWordsCovered() const { return std::count(m_bitmap.begin(), m_bitmap.end(), true); @@ -141,8 +154,6 @@ public: return NOT_FOUND; } - bool IsAdjacent(size_t startPos, size_t endPos) const; - //! whether a word has been translated at a particular position bool GetValue(size_t pos) const { return bool(m_bitmap[pos]); @@ -152,19 +163,6 @@ public: m_bitmap[pos] = value; UpdateFirstGap(pos, pos, value); } - //! set value between 2 positions, inclusive - void - SetValue( size_t startPos, size_t endPos, bool value ) { - for(size_t pos = startPos ; pos <= endPos ; pos++) { - m_bitmap[pos] = value; - } - UpdateFirstGap(startPos, endPos, value); - } - - void - SetValue(Range const& range, bool val) { - SetValue(range.GetStartPos(), range.GetEndPos(), val); - } //! whether every word has been translated bool IsComplete() const { |