diff options
Diffstat (limited to 'moses/src/ChartTrellisPathCollection.cpp')
-rw-r--r-- | moses/src/ChartTrellisPathCollection.cpp | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/moses/src/ChartTrellisPathCollection.cpp b/moses/src/ChartTrellisPathCollection.cpp deleted file mode 100644 index 5e05d1eaa..000000000 --- a/moses/src/ChartTrellisPathCollection.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// $Id$ -// vim:tabstop=2 -/*********************************************************************** - Moses - factored phrase-based language decoder - Copyright (C) 2010 Hieu Hoang - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - ***********************************************************************/ - -#include "ChartTrellisPathCollection.h" -#include "ChartTrellisPath.h" - -namespace Moses -{ - -ChartTrellisPathCollection::~ChartTrellisPathCollection() -{ - // clean up - RemoveAllInColl(m_collection); -} - -void ChartTrellisPathCollection::Add(ChartTrellisPath *path) -{ - m_collection.insert(path); -} - -void ChartTrellisPathCollection::Prune(size_t newSize) -{ - size_t currSize = m_collection.size(); - - if (currSize <= newSize) - return; // don't need to prune - - CollectionType::reverse_iterator iterRev; - for (iterRev = m_collection.rbegin() ; iterRev != m_collection.rend() ; ++iterRev) { - ChartTrellisPath *trellisPath = *iterRev; - delete trellisPath; - - currSize--; - if (currSize == newSize) - break; - } - - // delete path in m_collection - CollectionType::iterator iter = m_collection.begin(); - for (size_t i = 0 ; i < newSize ; ++i) - iter++; - - m_collection.erase(iter, m_collection.end()); -} - -} - |