From 827cdb7570e6e21ec313a8ccf4a69de3adfac664 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Fri, 8 Aug 2014 12:10:37 +0200
Subject: [PATCH] cleanup

---
 alib2data/src/alphabet/BlankSymbol.cpp            |  2 +-
 alib2data/src/alphabet/BottomOfTheStackSymbol.cpp |  4 ++--
 alib2data/src/alphabet/EndSymbol.cpp              |  4 ++--
 alib2data/src/alphabet/SymbolBase.cpp             |  8 ++++++++
 alib2data/src/alphabet/SymbolBase.h               | 12 ++++++++----
 alib2data/src/label/CharacterLabel.h              |  2 +-
 alib2data/src/label/LabelBase.h                   | 14 +++++++-------
 7 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/alib2data/src/alphabet/BlankSymbol.cpp b/alib2data/src/alphabet/BlankSymbol.cpp
index 2f4f17821e..a16b784d1f 100644
--- a/alib2data/src/alphabet/BlankSymbol.cpp
+++ b/alib2data/src/alphabet/BlankSymbol.cpp
@@ -46,7 +46,7 @@ void BlankSymbol::operator>>(std::ostream& out) const {
 }
 
 BlankSymbol::operator std::string () const {
-	return "";
+	return "B";
 }
 
 BlankSymbol BlankSymbol::BLANK = BlankSymbol();
diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp b/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp
index 7aa1015591..8250981971 100644
--- a/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp
+++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp
@@ -42,11 +42,11 @@ bool BottomOfTheStackSymbol::operator <(const BottomOfTheStackSymbol&) const {
 }
 
 void BottomOfTheStackSymbol::operator>>(std::ostream& out) const {
-	out << "(Blank symbol)";
+	out << "(BottomOfTheStackSymbol)";
 }
 
 BottomOfTheStackSymbol::operator std::string () const {
-	return "";
+	return "T";
 }
 
 BottomOfTheStackSymbol BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK = BottomOfTheStackSymbol();
diff --git a/alib2data/src/alphabet/EndSymbol.cpp b/alib2data/src/alphabet/EndSymbol.cpp
index 05efd4a4f3..97cb86d67e 100644
--- a/alib2data/src/alphabet/EndSymbol.cpp
+++ b/alib2data/src/alphabet/EndSymbol.cpp
@@ -42,11 +42,11 @@ bool EndSymbol::operator <(const EndSymbol&) const {
 }
 
 void EndSymbol::operator>>(std::ostream& out) const {
-	out << "(Blank symbol)";
+	out << "(EndSymbol)";
 }
 
 EndSymbol::operator std::string () const {
-	return "";
+	return "$";
 }
 
 EndSymbol EndSymbol::END = EndSymbol();
diff --git a/alib2data/src/alphabet/SymbolBase.cpp b/alib2data/src/alphabet/SymbolBase.cpp
index b26548fa9e..5b5bd2ff81 100644
--- a/alib2data/src/alphabet/SymbolBase.cpp
+++ b/alib2data/src/alphabet/SymbolBase.cpp
@@ -19,6 +19,14 @@ SymbolBase::~SymbolBase() noexcept {
 
 }
 
+bool SymbolBase::operator>=(const SymbolBase& other) const {
+	return !(*this < other);
+}
+
+bool SymbolBase::operator<=(const SymbolBase& other) const {
+	return !(*this > other);
+}
+
 bool SymbolBase::operator !=(const SymbolBase& other) const {
 	return !(*this == other);
 }
diff --git a/alib2data/src/alphabet/SymbolBase.h b/alib2data/src/alphabet/SymbolBase.h
index fae6048427..8d3ae6d977 100644
--- a/alib2data/src/alphabet/SymbolBase.h
+++ b/alib2data/src/alphabet/SymbolBase.h
@@ -26,22 +26,26 @@ public:
 	virtual ~SymbolBase() noexcept;
 
 	virtual SymbolBase* clone() const = 0;
-	virtual SymbolBase* plunder() && = 0; 
+	virtual SymbolBase* plunder() && = 0;
+
+	bool operator>=(const SymbolBase& other) const;
+
+	bool operator<=(const SymbolBase& other) const;
 
-	virtual bool operator <(const SymbolBase& other) const = 0;
-	virtual bool operator ==(const SymbolBase& other) const = 0;
-	virtual bool operator >(const SymbolBase& other) const = 0;
 	bool operator !=(const SymbolBase& other) const;
 
+	virtual bool operator==(const SymbolBase& other) const = 0;
 	virtual bool operator==(const LabeledSymbol& other) const;
 	virtual bool operator==(const BlankSymbol& other) const;
 	virtual bool operator==(const BottomOfTheStackSymbol& other) const;
 	virtual bool operator==(const EndSymbol& other) const;
 
+	virtual bool operator<(const SymbolBase& other) const = 0;
 	virtual bool operator<(const LabeledSymbol& other) const;
 	virtual bool operator<(const BlankSymbol& other) const;
 	virtual bool operator<(const BottomOfTheStackSymbol& other) const;
 	virtual bool operator<(const EndSymbol& other) const;
+	virtual bool operator>(const SymbolBase& other) const = 0;
 
 	friend std::ostream& operator<<(std::ostream&, const SymbolBase&);
 
diff --git a/alib2data/src/label/CharacterLabel.h b/alib2data/src/label/CharacterLabel.h
index 9e151ad252..82425597fa 100644
--- a/alib2data/src/label/CharacterLabel.h
+++ b/alib2data/src/label/CharacterLabel.h
@@ -33,7 +33,7 @@ public:
 	explicit CharacterLabel(char label);
 
 	virtual bool operator<(const LabelBase& other) const;
-	
+
 	virtual bool operator>(const LabelBase& other) const;
 
 	virtual bool operator==(const LabelBase& other) const;
diff --git a/alib2data/src/label/LabelBase.h b/alib2data/src/label/LabelBase.h
index 0ffa8f44c8..26b5801e3e 100644
--- a/alib2data/src/label/LabelBase.h
+++ b/alib2data/src/label/LabelBase.h
@@ -27,25 +27,25 @@ public:
 	virtual LabelBase* plunder() && = 0;
 
 	virtual ~LabelBase() noexcept;
-	
+
 	virtual bool operator<(const LabelBase& other) const = 0;
-	
+
 	virtual bool operator<(const StringLabel& other) const;
-	
+
 	virtual bool operator<(const IntegerLabel& other) const;
-	
+
 	virtual bool operator<(const CharacterLabel& other) const;
-	
+
 	virtual bool operator>(const LabelBase& other) const = 0;
 
-	
+
 	bool operator>=(const LabelBase& other) const;
 
 	bool operator<=(const LabelBase& other) const;
 
 	bool operator!=(const LabelBase& other) const;
 
-	
+
 	virtual bool operator==(const LabelBase& other) const = 0;
 
 	virtual bool operator==(const StringLabel& other) const;
-- 
GitLab