/*
    Copyright (C) 2012 Bartosz Broda, Jacek Bochenek, Łukasz Biłeńkij, 
    Damian Jaworski, Wojciech Mazur, Dominik Piasecki, Maciej Piasecki, 
    Radosław Ramocki
    
    This program 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 3 of the License, or (at your option)
any later version.

    This program 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 LICENSE and COPYING files for more details.
*/

#include "lex_headers.h" 
#include "SimpleWord.h"

namespace LexicalUnits
{
	SimpleWord::SimpleWord(boost::shared_ptr<Word> head)
		: LexicalUnit(std::vector<boost::shared_ptr<Word> > (), head->GetBaseIndex(), head->GetTag().FlexClass )
	{
		m_vConstituents.push_back(head);
	}

	std::string SimpleWord::ToXmlString()
	{
		throw std::string("SimpleWord::ToXmlString not implemented");
		//TODO SimpleWord::ToXmlString()
		return "";
	}

	bool SimpleWord::CheckCurrentPosition ( Corpus::CSentence &sentence, size_t &head_index,
								std::set<size_t> &constituents )
	{
		Corpus::CToken * pToken = sentence.GetCurrentToken();
		constituents.clear();
		for(size_t lex_no = 0; lex_no < pToken->GetLexCount(); lex_no++)
		{
			Corpus::CLexem *pDisamb = pToken->GetLexem(lex_no);
			
			if(! pDisamb->GetDisamb() )
				continue;

			if( (* m_vConstituents[0] ) == *pDisamb)
			{
				head_index = (size_t) sentence.GetPosition();
				return true;
			}

		}

		return false;
	}

}//namespace LexicalUnits


