Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
TerminatingSymbolAlphabet.cpp 1.12 KiB
/*
 * TerminatingSymbolAlphabet.cpp
 *
 *  Created on: Nov 23, 2013
 *      Author: Jan Travnicek
 */

#include "TerminatingSymbolAlphabet.h"
#include "../../../exception/AlibException.h"

namespace indexes {

TerminatingSymbolAlphabet::TerminatingSymbolAlphabet ( alphabet::Symbol terminatingSymbol ) : terminatingSymbol ( terminatingSymbol ) {
	addSymbol ( std::move ( terminatingSymbol ) );
}

const std::set < alphabet::Symbol > & TerminatingSymbolAlphabet::getAlphabet ( ) const {
	return this->alphabet;
}

void TerminatingSymbolAlphabet::addSymbol ( alphabet::Symbol symbol ) {
	this->alphabet.insert ( std::move ( symbol ) );
}

void TerminatingSymbolAlphabet::setTerminatingSymbol ( alphabet::Symbol newTerminatingSymbol ) {
	if ( !alphabet.count ( newTerminatingSymbol ) )
		throw exception::AlibException ( "Symbol " + ( std::string ) newTerminatingSymbol + " cannot be set as terminating symbol. It is not present in the alphabet." );

	terminatingSymbol = std::move ( newTerminatingSymbol );
}

const alphabet::Symbol & TerminatingSymbolAlphabet::getTerminatingSymbol ( ) const {
	return terminatingSymbol;
}

} /* namespace indexes */