-
Jan Trávníček authoredJan Trávníček authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
LinearString.h 1.75 KiB
/*
* LinearString.h
*
* Created on: Nov 23, 2013
* Author: Jan Travnicek
*/
#ifndef LINEAR_STRING_H_
#define LINEAR_STRING_H_
#include <iostream>
#include <set>
#include <vector>
#include "../std/visitor.hpp"
#include "../alphabet/Symbol.h"
#include "StringBase.h"
namespace string {
/**
* Represents regular expression parsed from the XML. Regular expression is stored
* as a tree of LinearStringElement.
*/
class LinearString : public std::element<LinearString, StringBase> {
protected:
std::vector<alphabet::Symbol> m_Data;
virtual bool testSymbol( const alphabet::Symbol & symbol ) const;
virtual void computeMinimalAlphabet(std::set<alphabet::Symbol>&) const;
public:
explicit LinearString(const std::vector<alphabet::Symbol>& data);
explicit LinearString(std::vector<alphabet::Symbol>&& data);
virtual StringBase* clone() const;
virtual StringBase* plunder() &&;
virtual bool operator <(const StringBase& other) const;
virtual bool operator ==(const StringBase& other) const;
virtual bool operator >(const StringBase& other) const;
/**
* @return List of symbols forming string (const version).
*/
const std::vector<alphabet::Symbol>& getContent() const;
/**
* @return true if string is an empty word (vector length is 0)
*/
bool isEmpty() const;
virtual bool operator<(const LinearString& other) const;
virtual bool operator<(const CyclicString& other) const;
virtual bool operator<(const Epsilon& other) const;
virtual bool operator==(const LinearString& other) const;
virtual bool operator==(const CyclicString& other) const;
virtual bool operator==(const Epsilon& other) const;
virtual void operator >>(std::ostream& out) const;
virtual operator std::string() const;
};
} /* namespace string */
#endif /* LINEAR_STRING_H_ */