-
Jan Trávníček authoredJan Trávníček authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Epsilon.cpp 1.82 KiB
/*
* Epsilon.cpp
*
* Created on: Jan 30, 2014
* Author: Jan Travnicek
*/
#include "Epsilon.h"
#include <sstream>
#include "LinearString.h"
#include "CyclicString.h"
namespace string {
Epsilon::Epsilon() {
}
StringBase* Epsilon::clone() const {
return new Epsilon(*this);
}
StringBase* Epsilon::plunder() && {
return new Epsilon(std::move(*this));
}
const std::set<alphabet::Symbol>& Epsilon::getAlphabet() const {
return alphabet;
}
bool Epsilon::addSymbolToAlphabet(const alphabet::Symbol & symbol) {
return alphabet.insert(symbol).second;
}
void Epsilon::setAlphabet(const std::set<alphabet::Symbol> & symbols) {
this->alphabet = symbols;
}
bool Epsilon::removeSymbolFromAlphabet(const alphabet::Symbol & symbol) {
return alphabet.erase(symbol);
}
bool Epsilon::operator<(const StringBase& other) const {
return other > *this;
}
bool Epsilon::operator==(const StringBase& other) const {
return other == *this;
}
bool Epsilon::operator>(const StringBase& other) const {
return other < *this;
}
std::vector<alphabet::Symbol> Epsilon::getContent() const {
return {};
}
bool Epsilon::isEmpty() const {
return true;
}
bool Epsilon::operator<(const Epsilon&) const {
return false;
}
bool Epsilon::operator<(const LinearString& other) const {
return LinearString {} < other;
}
bool Epsilon::operator<(const CyclicString& other) const {
return CyclicString {} < other;
}
bool Epsilon::operator==(const Epsilon&) const {
return true;
}
bool Epsilon::operator==(const LinearString& other) const {
return LinearString {} == other;
}
bool Epsilon::operator==(const CyclicString& other) const {
return CyclicString {} == other;
}
void Epsilon::operator>>(std::ostream& out) const {
out << "(Epsilon)";
}
Epsilon::operator std::string() const {
return "E";
}
Epsilon Epsilon::EPSILON = Epsilon();
} /* namespace string */