From b70e6fca3362917488168f28b63a36f50167032a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <peckato1@fit.cvut.cz>
Date: Thu, 18 Sep 2014 07:42:55 +0200
Subject: [PATCH] Remove regexp's isEmpty and containsEpsilon also from
 FormalRE

---
 alib2data/src/regexp/formal/FormalRegExp.cpp         |  8 --------
 alib2data/src/regexp/formal/FormalRegExp.h           | 10 ----------
 .../src/regexp/formal/FormalRegExpAlternation.cpp    |  8 --------
 .../src/regexp/formal/FormalRegExpAlternation.h      |  9 ---------
 .../src/regexp/formal/FormalRegExpConcatenation.cpp  |  8 --------
 .../src/regexp/formal/FormalRegExpConcatenation.h    | 10 ----------
 alib2data/src/regexp/formal/FormalRegExpElement.h    | 10 ----------
 alib2data/src/regexp/formal/FormalRegExpEmpty.cpp    |  8 --------
 alib2data/src/regexp/formal/FormalRegExpEmpty.h      | 10 ----------
 alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp  | 10 +---------
 alib2data/src/regexp/formal/FormalRegExpEpsilon.h    | 12 +-----------
 .../src/regexp/formal/FormalRegExpIteration.cpp      |  8 --------
 alib2data/src/regexp/formal/FormalRegExpIteration.h  | 10 ----------
 alib2data/src/regexp/formal/FormalRegExpSymbol.cpp   |  8 --------
 alib2data/src/regexp/formal/FormalRegExpSymbol.h     | 10 ----------
 15 files changed, 2 insertions(+), 137 deletions(-)

diff --git a/alib2data/src/regexp/formal/FormalRegExp.cpp b/alib2data/src/regexp/formal/FormalRegExp.cpp
index 0fa12a0085..62241b7b6b 100644
--- a/alib2data/src/regexp/formal/FormalRegExp.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExp.cpp
@@ -138,14 +138,6 @@ bool FormalRegExp::removeSymbolFromAlphabet(const alphabet::Symbol & symbol) {
 	return alphabet.erase(symbol);
 }
 
-bool FormalRegExp::isEmpty() const {
-	return regExp->isEmpty();
-}
-
-bool FormalRegExp::containsEmptyString() const {
-	return regExp->containsEmptyString();
-}
-
 void FormalRegExp::operator >>(std::ostream& out) const {
 	out << "(FormalRegExp " << *(this->regExp) << ")";
 }
diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h
index 3c0b587b4c..e52d6c6ad2 100644
--- a/alib2data/src/regexp/formal/FormalRegExp.h
+++ b/alib2data/src/regexp/formal/FormalRegExp.h
@@ -105,16 +105,6 @@ public:
 	 */
 	bool removeSymbolFromAlphabet(const alphabet::Symbol & symbol);
 
-	/**
-	 * @return true if regexp represents empty language
-	 */
-	bool isEmpty() const;
-
-	/**
-	 * @return true if regexp matches empty string (epsilon)
-	 */
-	bool containsEmptyString() const;
-
 	/**
 	 * Prints XML representation of the RegExp to the output stream.
 	 * @param out output stream to which print the RegExp
diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp b/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp
index 9ef0dd8253..81b85de9aa 100644
--- a/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp
@@ -176,12 +176,4 @@ void FormalRegExpAlternation::computeMinimalAlphabet( std::set<alphabet::Symbol>
 	right->computeMinimalAlphabet(alphabet);
 }
 
-bool FormalRegExpAlternation::containsEmptyString() const {
-	return left->containsEmptyString() || right->containsEmptyString();
-}
-
-bool FormalRegExpAlternation::isEmpty() const {
-	return left->isEmpty() && right->isEmpty();
-}
-
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.h b/alib2data/src/regexp/formal/FormalRegExpAlternation.h
index 00376a6fc9..de9886b04a 100644
--- a/alib2data/src/regexp/formal/FormalRegExpAlternation.h
+++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.h
@@ -98,15 +98,6 @@ public:
 	 */
 	virtual void operator>>(std::ostream& out) const;
 
-	/**
-	 * @copydoc FormalRegExpElement::containsEmptyString() const
-	 */
-	virtual bool containsEmptyString() const;
-
-	/**
-	 * @copydoc FormalRegExpElement::isEmpty() const
-	 */
-	virtual bool isEmpty() const;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp
index dab550bb6a..c65187ec1f 100644
--- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp
@@ -176,12 +176,4 @@ void FormalRegExpConcatenation::computeMinimalAlphabet( std::set<alphabet::Symbo
 	right->computeMinimalAlphabet(alphabet);
 }
 
-bool FormalRegExpConcatenation::containsEmptyString() const {
-	return left->containsEmptyString() && right->containsEmptyString();
-}
-
-bool FormalRegExpConcatenation::isEmpty() const {
-	return left->isEmpty() || right->isEmpty();
-}
-
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
index b2828eddc0..91405bdc4f 100644
--- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
+++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
@@ -94,16 +94,6 @@ public:
 	 * @copydoc FormalRegExpElement::operator>>() const
 	 */
 	virtual void operator>>(std::ostream& out) const;
-	
-	/**
-	 * @copydoc FormalRegExpElement::containsEmptyString() const
-	 */
-	virtual bool containsEmptyString() const;
-
-	/**
-	 * @copydoc FormalRegExpElement::isEmpty() const
-	 */
-	virtual bool isEmpty() const;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpElement.h b/alib2data/src/regexp/formal/FormalRegExpElement.h
index a8c83b1522..d39e8adb2c 100644
--- a/alib2data/src/regexp/formal/FormalRegExpElement.h
+++ b/alib2data/src/regexp/formal/FormalRegExpElement.h
@@ -114,16 +114,6 @@ public:
 	 */
 	friend std::ostream& operator<<(std::ostream& out, const FormalRegExpElement& regexp);
 
-	/**
-	 * @return true if this subtree of regexp matches empty string (epsilon)
-	 */
-	virtual bool containsEmptyString() const = 0;
-
-	/**
-	 * @return true if this subtree describes empty language
-	 */
-	virtual bool isEmpty() const = 0;
-	
 	friend class FormalRegExp;
 	
 	friend class FormalRegExpAlternation;
diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp b/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp
index 17f69d97b8..fb070961aa 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp
@@ -83,12 +83,4 @@ void FormalRegExpEmpty::computeMinimalAlphabet( std::set<alphabet::Symbol>&) con
 
 }
 
-bool FormalRegExpEmpty::containsEmptyString() const {
-	return false;
-}
-
-bool FormalRegExpEmpty::isEmpty() const {
-	return true;
-}
-
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.h b/alib2data/src/regexp/formal/FormalRegExpEmpty.h
index cbda513868..036bdc40af 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEmpty.h
+++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.h
@@ -65,16 +65,6 @@ public:
 	 * @copydoc FormalRegExpElement::operator>>() const
 	 */
 	virtual void operator>>(std::ostream& out) const;
-	
-	/**
-	 * @copydoc FormalRegExpElement::containsEmptyString() const
-	 */
-	virtual bool containsEmptyString() const;
-
-	/**
-	 * @copydoc FormalRegExpElement::isEmpty() const
-	 */
-	virtual bool isEmpty() const;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp b/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp
index b434618e3a..1629e334e0 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp
@@ -31,7 +31,7 @@ FormalRegExpEpsilon& FormalRegExpEpsilon::operator =(FormalRegExpEpsilon&&) noex
   //this is actually different than default implementation
   return *this;
 }
-  
+
 FormalRegExpElement* FormalRegExpEpsilon::clone() const {
 	return new FormalRegExpEpsilon(*this);
 }
@@ -83,12 +83,4 @@ void FormalRegExpEpsilon::computeMinimalAlphabet( std::set<alphabet::Symbol>&) c
 
 }
 
-bool FormalRegExpEpsilon::containsEmptyString() const {
-	return true;
-}
-
-bool FormalRegExpEpsilon::isEmpty() const {
-	return false;
-}
-
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
index 2551f68dbd..0b62f7b518 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
+++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
@@ -38,7 +38,7 @@ protected:
 	virtual void computeMinimalAlphabet( std::set<alphabet::Symbol>& alphabet ) const;
 
 public:
-  
+
 	FormalRegExpEpsilon();
 	FormalRegExpEpsilon(const FormalRegExpEpsilon& other);
 	FormalRegExpEpsilon(FormalRegExpEpsilon&& other) noexcept;
@@ -66,16 +66,6 @@ public:
 	 * @copydoc FormalRegExpElement::operator>>() const
 	 */
 	virtual void operator>>(std::ostream& out) const;
-
-	/**
-	 * @copydoc FormalRegExpElement::containsEmptyString() const
-	 */
-	virtual bool containsEmptyString() const;
-
-	/**
-	 * @copydoc FormalRegExpElement::isEmpty() const
-	 */
-	virtual bool isEmpty() const;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.cpp b/alib2data/src/regexp/formal/FormalRegExpIteration.cpp
index 6f851535e6..f255ee33da 100644
--- a/alib2data/src/regexp/formal/FormalRegExpIteration.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpIteration.cpp
@@ -130,13 +130,5 @@ void FormalRegExpIteration::computeMinimalAlphabet( std::set<alphabet::Symbol>&
 	element->computeMinimalAlphabet(alphabet);
 }
 
-bool FormalRegExpIteration::containsEmptyString() const {
-	return true;
-}
-
-bool FormalRegExpIteration::isEmpty() const {
-	return false;
-}
-
 } /* namespace regexp */
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.h b/alib2data/src/regexp/formal/FormalRegExpIteration.h
index 71ecd1539d..e777b0e433 100644
--- a/alib2data/src/regexp/formal/FormalRegExpIteration.h
+++ b/alib2data/src/regexp/formal/FormalRegExpIteration.h
@@ -90,16 +90,6 @@ public:
 	 * @copydoc FormalRegExpElement::operator>>() const
 	 */
 	virtual void operator>>(std::ostream& out) const;
-
-	/**
-	 * @copydoc FormalRegExpElement::containsEmptyString() const
-	 */
-	virtual bool containsEmptyString() const;
-
-	/**
-	 * @copydoc FormalRegExpElement::isEmpty() const
-	 */
-	virtual bool isEmpty() const;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp b/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp
index 356e93f3a8..52d255b51e 100644
--- a/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp
@@ -102,14 +102,6 @@ void FormalRegExpSymbol::operator>>(std::ostream& out) const {
 	out << "(FormalRegExpSymbol " << symbol << ")";
 }
 
-bool FormalRegExpSymbol::containsEmptyString() const {
-	return false;
-}
-
-bool FormalRegExpSymbol::isEmpty() const {
-	return false;
-}
-
 bool FormalRegExpSymbol::testSymbol( const alphabet::Symbol & symbol ) const {
 	return symbol == this->symbol;
 }
diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.h b/alib2data/src/regexp/formal/FormalRegExpSymbol.h
index ad8ec2ed6b..85e438df57 100644
--- a/alib2data/src/regexp/formal/FormalRegExpSymbol.h
+++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.h
@@ -79,20 +79,10 @@ public:
 	 */
 	virtual void operator>>(std::ostream& out) const;
 	
-	/**
-	 * @copydoc FormalRegExpElement::containsEmptyString() const
-	 */
-	virtual bool containsEmptyString() const;
-
 	/**
 	 * Returns the string representation of RegExp Symbol.
 	 */
 	const alphabet::Symbol& getSymbol() const;
-
-	/**
-	 * @copydoc FormalRegExpElement::isEmpty() const
-	 */
-	virtual bool isEmpty() const;
 };
 
 } /* namespace regexp */
-- 
GitLab