Skip to content
Snippets Groups Projects
Commit f5b4f997 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

do not fallback to epsilon in trees while printing

parent da309a87
No related branches found
No related tags found
No related merge requests found
......@@ -147,7 +147,7 @@ bool PrefixRankedBarPattern::isEmpty ( ) const {
}
 
int PrefixRankedBarPattern::compare ( const PrefixRankedBarPattern & other ) const {
auto first = std::tie ( m_Data, alphabet );
auto first = std::tie ( m_Data, alphabet );
auto second = std::tie ( other.m_Data, other.alphabet );
 
std::compare < decltype ( first ) > comp;
......@@ -156,32 +156,22 @@ int PrefixRankedBarPattern::compare ( const PrefixRankedBarPattern & other ) con
}
 
void PrefixRankedBarPattern::operator >>( std::ostream & out ) const {
if ( this->isEmpty ( ) ) {
out << "(Epsilon)";
} else {
out << "(PrefixRankedBarPattern ";
out << "(PrefixRankedBarPattern ";
 
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
out << symbol;
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
out << symbol;
 
out << ")";
}
out << ")";
}
 
PrefixRankedBarPattern::operator std::string ( ) const {
std::stringstream ss;
ss << "\"";
 
if ( this->isEmpty ( ) ) {
ss << "E";
} else {
ss << "\"";
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
ss << "\"";
}
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
 
ss << "\"";
return std::move ( ss ).str ( );
}
 
......
......@@ -123,8 +123,8 @@ bool PrefixRankedBarTree::isEmpty ( ) const {
}
 
int PrefixRankedBarTree::compare ( const PrefixRankedBarTree & other ) const {
auto first = std::tie ( m_Data, alphabet );
auto second = std::tie ( other.m_Data, other.alphabet );
auto first = std::tie ( m_Data, getAlphabet() );
auto second = std::tie ( other.m_Data, other.getAlphabet() );
 
std::compare < decltype ( first ) > comp;
 
......@@ -132,32 +132,22 @@ int PrefixRankedBarTree::compare ( const PrefixRankedBarTree & other ) const {
}
 
void PrefixRankedBarTree::operator >>( std::ostream & out ) const {
if ( this->isEmpty ( ) ) {
out << "(Epsilon)";
} else {
out << "(PrefixRankedBarTree ";
out << "(PrefixRankedBarTree ";
 
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
out << symbol;
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
out << symbol;
 
out << ")";
}
out << ")";
}
 
PrefixRankedBarTree::operator std::string ( ) const {
std::stringstream ss;
ss << "\"";
 
if ( this->isEmpty ( ) ) {
ss << "E";
} else {
ss << "\"";
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
ss << "\"";
}
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
 
ss << "\"";
return std::move ( ss ).str ( );
}
 
......
......@@ -112,7 +112,7 @@ bool PrefixRankedPattern::isEmpty ( ) const {
}
 
int PrefixRankedPattern::compare ( const PrefixRankedPattern & other ) const {
auto first = std::tie ( m_Data, alphabet );
auto first = std::tie ( m_Data, alphabet );
auto second = std::tie ( other.m_Data, other.alphabet );
 
std::compare < decltype ( first ) > comp;
......@@ -121,32 +121,22 @@ int PrefixRankedPattern::compare ( const PrefixRankedPattern & other ) const {
}
 
void PrefixRankedPattern::operator >>( std::ostream & out ) const {
if ( this->isEmpty ( ) ) {
out << "(Epsilon)";
} else {
out << "(PrefixRankedPattern ";
out << "(PrefixRankedPattern ";
 
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
out << symbol;
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
out << symbol;
 
out << ")";
}
out << ")";
}
 
PrefixRankedPattern::operator std::string ( ) const {
std::stringstream ss;
ss << "\"";
 
if ( this->isEmpty ( ) ) {
ss << "E";
} else {
ss << "\"";
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
ss << "\"";
}
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
 
ss << "\"";
return std::move ( ss ).str ( );
}
 
......
......@@ -99,7 +99,7 @@ bool PrefixRankedTree::isEmpty ( ) const {
}
 
int PrefixRankedTree::compare ( const PrefixRankedTree & other ) const {
auto first = std::tie ( m_Data, alphabet );
auto first = std::tie ( m_Data, alphabet );
auto second = std::tie ( other.m_Data, other.alphabet );
 
std::compare < decltype ( first ) > comp;
......@@ -108,32 +108,22 @@ int PrefixRankedTree::compare ( const PrefixRankedTree & other ) const {
}
 
void PrefixRankedTree::operator >>( std::ostream & out ) const {
if ( this->isEmpty ( ) ) {
out << "(Epsilon)";
} else {
out << "(PrefixRankedTree ";
out << "(PrefixRankedTree ";
 
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
out << symbol;
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
out << symbol;
 
out << ")";
}
out << ")";
}
 
PrefixRankedTree::operator std::string ( ) const {
std::stringstream ss;
ss << "\"";
 
if ( this->isEmpty ( ) ) {
ss << "E";
} else {
ss << "\"";
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
ss << "\"";
}
for ( const alphabet::RankedSymbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
 
ss << "\"";
return std::move ( ss ).str ( );
}
 
......
......@@ -107,32 +107,22 @@ int PrefixBarTree::compare ( const PrefixBarTree & other ) const {
}
 
void PrefixBarTree::operator >>( std::ostream & out ) const {
if ( this->isEmpty ( ) ) {
out << "(Epsilon)";
} else {
out << "(PrefixBarTree ";
out << "(PrefixBarTree ";
 
for ( const alphabet::Symbol & symbol : this->m_Data )
out << symbol;
for ( const alphabet::Symbol & symbol : this->m_Data )
out << symbol;
 
out << ")";
}
out << ")";
}
 
PrefixBarTree::operator std::string ( ) const {
std::stringstream ss;
ss << "\"";
 
if ( this->isEmpty ( ) ) {
ss << "E";
} else {
ss << "\"";
for ( const alphabet::Symbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
ss << "\"";
}
for ( const alphabet::Symbol & symbol : this->m_Data )
ss << ( std::string ) symbol;
 
ss << "\"";
return std::move ( ss ).str ( );
}
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment