From d056c892d74dbc421bef08659781c3195068f7a9 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Thu, 20 Nov 2014 23:54:19 +0100 Subject: [PATCH] inline compare's double dispatch helper method --- alib2data/src/alphabet/BarSymbol.cpp | 4 ---- alib2data/src/alphabet/BarSymbol.h | 5 ++++- alib2data/src/alphabet/BlankSymbol.cpp | 4 ---- alib2data/src/alphabet/BlankSymbol.h | 5 ++++- alib2data/src/alphabet/BottomOfTheStackSymbol.cpp | 4 ---- alib2data/src/alphabet/BottomOfTheStackSymbol.h | 5 ++++- alib2data/src/alphabet/EndSymbol.cpp | 4 ---- alib2data/src/alphabet/EndSymbol.h | 5 ++++- alib2data/src/alphabet/LabeledSymbol.cpp | 4 ---- alib2data/src/alphabet/LabeledSymbol.h | 5 ++++- alib2data/src/alphabet/RankedBarSymbol.cpp | 4 ---- alib2data/src/alphabet/RankedBarSymbol.h | 5 ++++- alib2data/src/alphabet/RankedSymbol.cpp | 4 ---- alib2data/src/alphabet/RankedSymbol.h | 5 ++++- alib2data/src/alphabet/SubtreeWildcardSymbol.cpp | 4 ---- alib2data/src/alphabet/SubtreeWildcardSymbol.h | 5 ++++- alib2data/src/automaton/FSM/CompactNFA.cpp | 4 ---- alib2data/src/automaton/FSM/CompactNFA.h | 5 ++++- alib2data/src/automaton/FSM/DFA.cpp | 4 ---- alib2data/src/automaton/FSM/DFA.h | 5 ++++- alib2data/src/automaton/FSM/EpsilonNFA.cpp | 4 ---- alib2data/src/automaton/FSM/EpsilonNFA.h | 5 ++++- alib2data/src/automaton/FSM/ExtendedNFA.cpp | 4 ---- alib2data/src/automaton/FSM/ExtendedNFA.h | 5 ++++- alib2data/src/automaton/FSM/MultiInitialStateNFA.cpp | 4 ---- alib2data/src/automaton/FSM/MultiInitialStateNFA.h | 5 ++++- alib2data/src/automaton/FSM/NFA.cpp | 4 ---- alib2data/src/automaton/FSM/NFA.h | 5 ++++- alib2data/src/automaton/PDA/DPDA.cpp | 4 ---- alib2data/src/automaton/PDA/DPDA.h | 5 ++++- alib2data/src/automaton/PDA/InputDrivenNPDA.cpp | 4 ---- alib2data/src/automaton/PDA/InputDrivenNPDA.h | 5 ++++- alib2data/src/automaton/PDA/NPDA.cpp | 4 ---- alib2data/src/automaton/PDA/NPDA.h | 5 ++++- .../src/automaton/PDA/RealTimeHeightDeterministicDPDA.cpp | 4 ---- .../src/automaton/PDA/RealTimeHeightDeterministicDPDA.h | 5 ++++- .../src/automaton/PDA/RealTimeHeightDeterministicNPDA.cpp | 4 ---- .../src/automaton/PDA/RealTimeHeightDeterministicNPDA.h | 5 ++++- alib2data/src/automaton/PDA/SinglePopDPDA.cpp | 4 ---- alib2data/src/automaton/PDA/SinglePopDPDA.h | 5 ++++- alib2data/src/automaton/PDA/SinglePopNPDA.cpp | 4 ---- alib2data/src/automaton/PDA/SinglePopNPDA.h | 5 ++++- alib2data/src/automaton/PDA/VisiblyPushdownDPDA.cpp | 4 ---- alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h | 5 ++++- alib2data/src/automaton/PDA/VisiblyPushdownNPDA.cpp | 4 ---- alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h | 5 ++++- alib2data/src/automaton/TM/OneTapeDTM.cpp | 4 ---- alib2data/src/automaton/TM/OneTapeDTM.h | 5 ++++- alib2data/src/container/ObjectsMap.cpp | 4 ---- alib2data/src/container/ObjectsMap.h | 5 ++++- alib2data/src/container/ObjectsPair.cpp | 4 ---- alib2data/src/container/ObjectsPair.h | 5 ++++- alib2data/src/container/ObjectsSet.cpp | 4 ---- alib2data/src/container/ObjectsSet.h | 5 ++++- alib2data/src/container/ObjectsVector.cpp | 4 ---- alib2data/src/container/ObjectsVector.h | 5 ++++- alib2data/src/exception/AlibException.cpp | 4 ---- alib2data/src/exception/AlibException.h | 5 ++++- alib2data/src/grammar/ContextFree/CFG.cpp | 4 ---- alib2data/src/grammar/ContextFree/CFG.h | 5 ++++- alib2data/src/grammar/ContextFree/CNF.cpp | 4 ---- alib2data/src/grammar/ContextFree/CNF.h | 5 ++++- alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp | 4 ---- alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h | 5 ++++- alib2data/src/grammar/ContextFree/GNF.cpp | 4 ---- alib2data/src/grammar/ContextFree/GNF.h | 6 +++++- alib2data/src/grammar/ContextFree/LG.cpp | 4 ---- alib2data/src/grammar/ContextFree/LG.h | 5 ++++- alib2data/src/grammar/ContextSensitive/CSG.cpp | 4 ---- alib2data/src/grammar/ContextSensitive/CSG.h | 5 ++++- .../grammar/ContextSensitive/NonContractingGrammar.cpp | 4 ---- .../src/grammar/ContextSensitive/NonContractingGrammar.h | 5 ++++- alib2data/src/grammar/Regular/LeftLG.cpp | 4 ---- alib2data/src/grammar/Regular/LeftLG.h | 5 ++++- alib2data/src/grammar/Regular/LeftRG.cpp | 4 ---- alib2data/src/grammar/Regular/LeftRG.h | 4 +++- alib2data/src/grammar/Regular/RightLG.cpp | 4 ---- alib2data/src/grammar/Regular/RightLG.h | 5 ++++- alib2data/src/grammar/Regular/RightRG.cpp | 4 ---- alib2data/src/grammar/Regular/RightRG.h | 5 ++++- .../Unrestricted/ContextPreservingUnrestrictedGrammar.cpp | 4 ---- .../Unrestricted/ContextPreservingUnrestrictedGrammar.h | 5 ++++- .../src/grammar/Unrestricted/UnrestrictedGrammar.cpp | 4 ---- alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h | 5 ++++- alib2data/src/label/HexavigesimalLabel.cpp | 4 ---- alib2data/src/label/HexavigesimalLabel.h | 5 ++++- alib2data/src/label/LabelPairLabel.cpp | 4 ---- alib2data/src/label/LabelPairLabel.h | 5 ++++- alib2data/src/label/LabelSetLabel.cpp | 4 ---- alib2data/src/label/LabelSetLabel.h | 5 ++++- alib2data/src/label/ObjectLabel.cpp | 4 ---- alib2data/src/label/ObjectLabel.h | 4 +++- alib2data/src/label/PrimitiveLabel.cpp | 4 ---- alib2data/src/label/PrimitiveLabel.h | 5 ++++- alib2data/src/object/Void.cpp | 4 ---- alib2data/src/object/Void.h | 5 ++++- alib2data/src/primitive/Character.cpp | 4 ---- alib2data/src/primitive/Character.h | 5 ++++- alib2data/src/primitive/Integer.cpp | 4 ---- alib2data/src/primitive/Integer.h | 4 +++- alib2data/src/primitive/String.cpp | 4 ---- alib2data/src/primitive/String.h | 4 +++- alib2data/src/regexp/formal/FormalRegExp.cpp | 4 ---- alib2data/src/regexp/formal/FormalRegExp.h | 5 ++++- alib2data/src/regexp/formal/FormalRegExpAlternation.cpp | 4 ---- alib2data/src/regexp/formal/FormalRegExpAlternation.h | 5 ++++- alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp | 4 ---- alib2data/src/regexp/formal/FormalRegExpConcatenation.h | 5 ++++- alib2data/src/regexp/formal/FormalRegExpEmpty.cpp | 4 ---- alib2data/src/regexp/formal/FormalRegExpEmpty.h | 5 ++++- alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp | 4 ---- alib2data/src/regexp/formal/FormalRegExpEpsilon.h | 5 ++++- alib2data/src/regexp/formal/FormalRegExpIteration.cpp | 4 ---- alib2data/src/regexp/formal/FormalRegExpIteration.h | 5 ++++- alib2data/src/regexp/formal/FormalRegExpSymbol.cpp | 4 ---- alib2data/src/regexp/formal/FormalRegExpSymbol.h | 5 ++++- alib2data/src/regexp/unbounded/UnboundedRegExp.cpp | 4 ---- alib2data/src/regexp/unbounded/UnboundedRegExp.h | 5 ++++- .../src/regexp/unbounded/UnboundedRegExpAlternation.cpp | 4 ---- .../src/regexp/unbounded/UnboundedRegExpAlternation.h | 5 ++++- .../src/regexp/unbounded/UnboundedRegExpConcatenation.cpp | 4 ---- .../src/regexp/unbounded/UnboundedRegExpConcatenation.h | 5 ++++- alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp | 4 ---- alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h | 5 ++++- alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp | 4 ---- alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h | 8 +++++--- .../src/regexp/unbounded/UnboundedRegExpIteration.cpp | 4 ---- alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h | 5 ++++- alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp | 4 ---- alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h | 5 ++++- alib2data/src/string/CyclicString.cpp | 4 ---- alib2data/src/string/CyclicString.h | 4 +++- alib2data/src/string/Epsilon.cpp | 4 ---- alib2data/src/string/Epsilon.h | 4 +++- alib2data/src/string/LinearString.cpp | 4 ---- alib2data/src/string/LinearString.h | 4 +++- 136 files changed, 267 insertions(+), 342 deletions(-) diff --git a/alib2data/src/alphabet/BarSymbol.cpp b/alib2data/src/alphabet/BarSymbol.cpp index 03aeee92a6..0b4f3017be 100644 --- a/alib2data/src/alphabet/BarSymbol.cpp +++ b/alib2data/src/alphabet/BarSymbol.cpp @@ -21,10 +21,6 @@ SymbolBase* BarSymbol::plunder() && { return new BarSymbol(std::move(*this)); } -int BarSymbol::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int BarSymbol::compare(const BarSymbol&) const { return 0; } diff --git a/alib2data/src/alphabet/BarSymbol.h b/alib2data/src/alphabet/BarSymbol.h index 8c0a0504d4..4e8daaaf62 100644 --- a/alib2data/src/alphabet/BarSymbol.h +++ b/alib2data/src/alphabet/BarSymbol.h @@ -26,7 +26,10 @@ public: virtual SymbolBase* clone() const; virtual SymbolBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const BarSymbol& other) const; virtual void operator>>(std::ostream& out) const; diff --git a/alib2data/src/alphabet/BlankSymbol.cpp b/alib2data/src/alphabet/BlankSymbol.cpp index 6217ac0c8e..93dfb7f02b 100644 --- a/alib2data/src/alphabet/BlankSymbol.cpp +++ b/alib2data/src/alphabet/BlankSymbol.cpp @@ -21,10 +21,6 @@ SymbolBase* BlankSymbol::plunder() && { return new BlankSymbol(std::move(*this)); } -int BlankSymbol::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int BlankSymbol::compare(const BlankSymbol&) const { return 0; } diff --git a/alib2data/src/alphabet/BlankSymbol.h b/alib2data/src/alphabet/BlankSymbol.h index 29d0a20a09..bf7f2d1312 100644 --- a/alib2data/src/alphabet/BlankSymbol.h +++ b/alib2data/src/alphabet/BlankSymbol.h @@ -26,7 +26,10 @@ public: virtual SymbolBase* clone() const; virtual SymbolBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const BlankSymbol& other) const; virtual void operator>>(std::ostream& out) const; diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp b/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp index f20bbf187d..99b9301144 100644 --- a/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp +++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp @@ -21,10 +21,6 @@ SymbolBase* BottomOfTheStackSymbol::plunder() && { return new BottomOfTheStackSymbol(std::move(*this)); } -int BottomOfTheStackSymbol::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int BottomOfTheStackSymbol::compare(const BottomOfTheStackSymbol&) const { return 0; } diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.h b/alib2data/src/alphabet/BottomOfTheStackSymbol.h index af7f4c569a..99abe4f709 100644 --- a/alib2data/src/alphabet/BottomOfTheStackSymbol.h +++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.h @@ -26,7 +26,10 @@ public: virtual SymbolBase* clone() const; virtual SymbolBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const BottomOfTheStackSymbol& other) const; virtual void operator>>(std::ostream& out) const; diff --git a/alib2data/src/alphabet/EndSymbol.cpp b/alib2data/src/alphabet/EndSymbol.cpp index 958950ee59..6beea7a684 100644 --- a/alib2data/src/alphabet/EndSymbol.cpp +++ b/alib2data/src/alphabet/EndSymbol.cpp @@ -21,10 +21,6 @@ SymbolBase* EndSymbol::plunder() && { return new EndSymbol(std::move(*this)); } -int EndSymbol::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int EndSymbol::compare(const EndSymbol&) const { return 0; } diff --git a/alib2data/src/alphabet/EndSymbol.h b/alib2data/src/alphabet/EndSymbol.h index 476e864e80..50a735a324 100644 --- a/alib2data/src/alphabet/EndSymbol.h +++ b/alib2data/src/alphabet/EndSymbol.h @@ -26,7 +26,10 @@ public: virtual SymbolBase* clone() const; virtual SymbolBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const EndSymbol& other) const; virtual void operator>>(std::ostream& out) const; diff --git a/alib2data/src/alphabet/LabeledSymbol.cpp b/alib2data/src/alphabet/LabeledSymbol.cpp index 8bb3cee5d0..ddc46cc9e9 100644 --- a/alib2data/src/alphabet/LabeledSymbol.cpp +++ b/alib2data/src/alphabet/LabeledSymbol.cpp @@ -41,10 +41,6 @@ const label::Label& LabeledSymbol::getLabel() const { return label; } -int LabeledSymbol::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int LabeledSymbol::compare(const LabeledSymbol& other) const { return this->label.getData().compare(other.label.getData()); } diff --git a/alib2data/src/alphabet/LabeledSymbol.h b/alib2data/src/alphabet/LabeledSymbol.h index 528bb40dd0..9e8192ed09 100644 --- a/alib2data/src/alphabet/LabeledSymbol.h +++ b/alib2data/src/alphabet/LabeledSymbol.h @@ -41,7 +41,10 @@ public: */ const label::Label& getLabel() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const LabeledSymbol& other) const; virtual void operator>>(std::ostream& out) const; diff --git a/alib2data/src/alphabet/RankedBarSymbol.cpp b/alib2data/src/alphabet/RankedBarSymbol.cpp index 9fbee197e0..b9ad90876b 100644 --- a/alib2data/src/alphabet/RankedBarSymbol.cpp +++ b/alib2data/src/alphabet/RankedBarSymbol.cpp @@ -29,10 +29,6 @@ const primitive::Integer& RankedBarSymbol::getRank() const { return rank; } -int RankedBarSymbol::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int RankedBarSymbol::compare(const RankedBarSymbol&) const { return 0; } diff --git a/alib2data/src/alphabet/RankedBarSymbol.h b/alib2data/src/alphabet/RankedBarSymbol.h index ca40d8622e..bbd6fa8acd 100644 --- a/alib2data/src/alphabet/RankedBarSymbol.h +++ b/alib2data/src/alphabet/RankedBarSymbol.h @@ -34,7 +34,10 @@ public: */ const primitive::Integer& getRank() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const RankedBarSymbol& other) const; virtual void operator>>(std::ostream& out) const; diff --git a/alib2data/src/alphabet/RankedSymbol.cpp b/alib2data/src/alphabet/RankedSymbol.cpp index 5b09ee5b64..32eee89252 100644 --- a/alib2data/src/alphabet/RankedSymbol.cpp +++ b/alib2data/src/alphabet/RankedSymbol.cpp @@ -45,10 +45,6 @@ const primitive::Integer& RankedSymbol::getRank() const { return rank; } -int RankedSymbol::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int RankedSymbol::compare(const RankedSymbol& other) const { int res = this->label.getData().compare(other.label.getData()); if(res == 0) res = this->rank.compare(other.rank); diff --git a/alib2data/src/alphabet/RankedSymbol.h b/alib2data/src/alphabet/RankedSymbol.h index 9f1ad0d3aa..0b4d86a0ab 100644 --- a/alib2data/src/alphabet/RankedSymbol.h +++ b/alib2data/src/alphabet/RankedSymbol.h @@ -49,7 +49,10 @@ public: */ const primitive::Integer& getRank() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const RankedSymbol& other) const; virtual void operator>>(std::ostream& out) const; diff --git a/alib2data/src/alphabet/SubtreeWildcardSymbol.cpp b/alib2data/src/alphabet/SubtreeWildcardSymbol.cpp index 908adc43c0..adf069bb6c 100644 --- a/alib2data/src/alphabet/SubtreeWildcardSymbol.cpp +++ b/alib2data/src/alphabet/SubtreeWildcardSymbol.cpp @@ -21,10 +21,6 @@ SymbolBase* SubtreeWildcardSymbol::plunder() && { return new SubtreeWildcardSymbol(std::move(*this)); } -int SubtreeWildcardSymbol::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int SubtreeWildcardSymbol::compare(const SubtreeWildcardSymbol&) const { return 0; } diff --git a/alib2data/src/alphabet/SubtreeWildcardSymbol.h b/alib2data/src/alphabet/SubtreeWildcardSymbol.h index 5a8e9c31c7..6c1480a898 100644 --- a/alib2data/src/alphabet/SubtreeWildcardSymbol.h +++ b/alib2data/src/alphabet/SubtreeWildcardSymbol.h @@ -26,7 +26,10 @@ public: virtual SymbolBase* clone() const; virtual SymbolBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const SubtreeWildcardSymbol& other) const; virtual void operator>>(std::ostream& out) const; diff --git a/alib2data/src/automaton/FSM/CompactNFA.cpp b/alib2data/src/automaton/FSM/CompactNFA.cpp index fa9ba83f73..16d53007a8 100644 --- a/alib2data/src/automaton/FSM/CompactNFA.cpp +++ b/alib2data/src/automaton/FSM/CompactNFA.cpp @@ -164,10 +164,6 @@ std::map<std::pair<State, string::LinearString>, std::set<State>> CompactNFA::ge return transitionsToState; } -int CompactNFA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int CompactNFA::compare(const CompactNFA& other) const { std::compare<decltype(states)> comp; int res = comp(states, other.states); diff --git a/alib2data/src/automaton/FSM/CompactNFA.h b/alib2data/src/automaton/FSM/CompactNFA.h index 0c7284a17e..26c8e8be07 100644 --- a/alib2data/src/automaton/FSM/CompactNFA.h +++ b/alib2data/src/automaton/FSM/CompactNFA.h @@ -79,7 +79,10 @@ public: */ std::map<std::pair<State, string::LinearString>, std::set<State>> getTransitionsToState(const State& from) const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const CompactNFA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/FSM/DFA.cpp b/alib2data/src/automaton/FSM/DFA.cpp index 1c8c5e1706..ec5169eeda 100644 --- a/alib2data/src/automaton/FSM/DFA.cpp +++ b/alib2data/src/automaton/FSM/DFA.cpp @@ -132,10 +132,6 @@ bool DFA::isTotal() const { return transitions.size() == inputAlphabet.size() * states.size(); } -int DFA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int DFA::compare(const DFA& other) const { auto first = std::tie(states, inputAlphabet, initialState, finalStates, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.transitions); diff --git a/alib2data/src/automaton/FSM/DFA.h b/alib2data/src/automaton/FSM/DFA.h index 1fb39a450c..b0552f6d68 100644 --- a/alib2data/src/automaton/FSM/DFA.h +++ b/alib2data/src/automaton/FSM/DFA.h @@ -80,7 +80,10 @@ public: */ bool isTotal() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const DFA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.cpp b/alib2data/src/automaton/FSM/EpsilonNFA.cpp index 99ebddec32..c053207f22 100644 --- a/alib2data/src/automaton/FSM/EpsilonNFA.cpp +++ b/alib2data/src/automaton/FSM/EpsilonNFA.cpp @@ -265,10 +265,6 @@ bool EpsilonNFA::isTotal() const { return isDeterministic() && transitions.size() == inputAlphabet.size() * states.size(); } -int EpsilonNFA::compare(const ObjectBase& other) const { - return other.compare(*this); -} - int EpsilonNFA::compare(const EpsilonNFA& other) const { auto first = std::tie(states, inputAlphabet, initialState, finalStates, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.transitions); diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.h b/alib2data/src/automaton/FSM/EpsilonNFA.h index 479b739d6b..28fad8d46e 100644 --- a/alib2data/src/automaton/FSM/EpsilonNFA.h +++ b/alib2data/src/automaton/FSM/EpsilonNFA.h @@ -158,7 +158,10 @@ public: */ bool isTotal() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const EpsilonNFA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.cpp b/alib2data/src/automaton/FSM/ExtendedNFA.cpp index 9e9a7a4201..663920663a 100644 --- a/alib2data/src/automaton/FSM/ExtendedNFA.cpp +++ b/alib2data/src/automaton/FSM/ExtendedNFA.cpp @@ -176,10 +176,6 @@ std::map<std::pair<State, regexp::RegExp>, std::set<State> > ExtendedNFA::getTra return transitionsToState; } -int ExtendedNFA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int ExtendedNFA::compare(const ExtendedNFA& other) const { auto first = std::tie(states, inputAlphabet, initialState, finalStates, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.transitions); diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.h b/alib2data/src/automaton/FSM/ExtendedNFA.h index 2f01c40289..16fd38b603 100644 --- a/alib2data/src/automaton/FSM/ExtendedNFA.h +++ b/alib2data/src/automaton/FSM/ExtendedNFA.h @@ -81,7 +81,10 @@ public: */ std::map<std::pair<State, regexp::RegExp>, std::set<State> > getTransitionsToState(const State& from) const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const ExtendedNFA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/FSM/MultiInitialStateNFA.cpp b/alib2data/src/automaton/FSM/MultiInitialStateNFA.cpp index 368272c2ac..fbe13322e8 100644 --- a/alib2data/src/automaton/FSM/MultiInitialStateNFA.cpp +++ b/alib2data/src/automaton/FSM/MultiInitialStateNFA.cpp @@ -155,10 +155,6 @@ unsigned MultiInitialStateNFA::transitionsSize() const { return res; } -int MultiInitialStateNFA::compare(const ObjectBase& other) const { - return other.compare(*this); -} - int MultiInitialStateNFA::compare(const MultiInitialStateNFA& other) const { auto first = std::tie(states, inputAlphabet, initialStates, finalStates, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.transitions); diff --git a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h index 82192f4e73..48bda23aa7 100644 --- a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h +++ b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h @@ -97,7 +97,10 @@ public: unsigned transitionsSize() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const MultiInitialStateNFA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/FSM/NFA.cpp b/alib2data/src/automaton/FSM/NFA.cpp index 510bf9c92d..72ee67a7fa 100644 --- a/alib2data/src/automaton/FSM/NFA.cpp +++ b/alib2data/src/automaton/FSM/NFA.cpp @@ -138,10 +138,6 @@ unsigned NFA::transitionsSize() const { return res; } -int NFA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int NFA::compare(const NFA& other) const { auto first = std::tie(states, inputAlphabet, initialState, finalStates, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.transitions); diff --git a/alib2data/src/automaton/FSM/NFA.h b/alib2data/src/automaton/FSM/NFA.h index 3fb615aed1..3d4bad88ec 100644 --- a/alib2data/src/automaton/FSM/NFA.h +++ b/alib2data/src/automaton/FSM/NFA.h @@ -95,7 +95,10 @@ public: unsigned transitionsSize() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const NFA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/PDA/DPDA.cpp b/alib2data/src/automaton/PDA/DPDA.cpp index 9db8052048..85bd138fe4 100644 --- a/alib2data/src/automaton/PDA/DPDA.cpp +++ b/alib2data/src/automaton/PDA/DPDA.cpp @@ -222,10 +222,6 @@ std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std: return transitionsToState; } -int DPDA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int DPDA::compare(const DPDA& other) const { auto first = std::tie(states, inputAlphabet, initialState, finalStates, stackAlphabet, initialSymbol, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.stackAlphabet, other.initialSymbol, other.transitions); diff --git a/alib2data/src/automaton/PDA/DPDA.h b/alib2data/src/automaton/PDA/DPDA.h index e5a8eafbc7..92d0465b9f 100644 --- a/alib2data/src/automaton/PDA/DPDA.h +++ b/alib2data/src/automaton/PDA/DPDA.h @@ -91,7 +91,10 @@ public: */ std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > > getTransitionsToState(const State& from) const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const DPDA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.cpp b/alib2data/src/automaton/PDA/InputDrivenNPDA.cpp index c91056b197..c6fa402b50 100644 --- a/alib2data/src/automaton/PDA/InputDrivenNPDA.cpp +++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.cpp @@ -174,10 +174,6 @@ bool InputDrivenNPDA::isDeterministic() const { return true; } -int InputDrivenNPDA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int InputDrivenNPDA::compare(const InputDrivenNPDA& other) const { auto first = std::tie(states, inputAlphabet, initialStates, finalStates, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.transitions); diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.h b/alib2data/src/automaton/PDA/InputDrivenNPDA.h index b841f4c819..d07ea51e14 100644 --- a/alib2data/src/automaton/PDA/InputDrivenNPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.h @@ -88,7 +88,10 @@ public: */ bool isDeterministic() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const InputDrivenNPDA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/PDA/NPDA.cpp b/alib2data/src/automaton/PDA/NPDA.cpp index c546b60c81..5407aaaed8 100644 --- a/alib2data/src/automaton/PDA/NPDA.cpp +++ b/alib2data/src/automaton/PDA/NPDA.cpp @@ -133,10 +133,6 @@ const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol> return transitions; } -int NPDA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int NPDA::compare(const NPDA& other) const { auto first = std::tie(states, inputAlphabet, initialStates, finalStates, stackAlphabet, initialSymbols, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.stackAlphabet, other.initialSymbols, other.transitions); diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h index f014897309..77631a27c0 100644 --- a/alib2data/src/automaton/PDA/NPDA.h +++ b/alib2data/src/automaton/PDA/NPDA.h @@ -75,7 +75,10 @@ public: */ const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& getTransitions() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const NPDA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.cpp b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.cpp index fe7b406fdc..0b44a8fafb 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.cpp +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.cpp @@ -366,10 +366,6 @@ const std::map<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>> return localTransitions; } -int RealTimeHeightDeterministicDPDA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int RealTimeHeightDeterministicDPDA::compare(const RealTimeHeightDeterministicDPDA& other) const { auto first = std::tie(states, inputAlphabet, initialState, finalStates, stackAlphabet, bottomOfTheStackSymbol, callTransitions, returnTransitions, localTransitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.stackAlphabet, other.bottomOfTheStackSymbol, other.callTransitions, other.returnTransitions, other.localTransitions); diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h index b27b051b7a..64e9ea3ccd 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h @@ -118,7 +118,10 @@ public: const std::map<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, State>& getLocalTransitions() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const RealTimeHeightDeterministicDPDA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.cpp b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.cpp index 4f1ee73d7c..8a5f75eade 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.cpp +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.cpp @@ -257,10 +257,6 @@ const std::map<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>> return localTransitions; } -int RealTimeHeightDeterministicNPDA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int RealTimeHeightDeterministicNPDA::compare(const RealTimeHeightDeterministicNPDA& other) const { auto first = std::tie(states, inputAlphabet, initialStates, finalStates, stackAlphabet, bottomOfTheStackSymbol, callTransitions, returnTransitions, localTransitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.stackAlphabet, other.bottomOfTheStackSymbol, other.callTransitions, other.returnTransitions, other.localTransitions); diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h index 165381a83c..21e85c58d4 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h @@ -118,7 +118,10 @@ public: const std::map<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<State> >& getLocalTransitions() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const RealTimeHeightDeterministicNPDA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.cpp b/alib2data/src/automaton/PDA/SinglePopDPDA.cpp index e46690da38..be45694060 100644 --- a/alib2data/src/automaton/PDA/SinglePopDPDA.cpp +++ b/alib2data/src/automaton/PDA/SinglePopDPDA.cpp @@ -168,10 +168,6 @@ const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol> return transitions; } -int SinglePopDPDA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int SinglePopDPDA::compare(const SinglePopDPDA& other) const { auto first = std::tie(states, inputAlphabet, initialState, finalStates, stackAlphabet, initialSymbol, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.stackAlphabet, other.initialSymbol, other.transitions); diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.h b/alib2data/src/automaton/PDA/SinglePopDPDA.h index 7b100c775d..3ac5eca2d4 100644 --- a/alib2data/src/automaton/PDA/SinglePopDPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopDPDA.h @@ -81,7 +81,10 @@ public: */ const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::pair<State, std::vector<alphabet::Symbol> > >& getTransitions() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const SinglePopDPDA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.cpp b/alib2data/src/automaton/PDA/SinglePopNPDA.cpp index e8c41744c0..b4040aa83a 100644 --- a/alib2data/src/automaton/PDA/SinglePopNPDA.cpp +++ b/alib2data/src/automaton/PDA/SinglePopNPDA.cpp @@ -129,10 +129,6 @@ const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol> return transitions; } -int SinglePopNPDA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int SinglePopNPDA::compare(const SinglePopNPDA& other) const { auto first = std::tie(states, inputAlphabet, initialStates, finalStates, stackAlphabet, initialSymbols, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.stackAlphabet, other.initialSymbols, other.transitions); diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h index 43b833db66..84ddfe5676 100644 --- a/alib2data/src/automaton/PDA/SinglePopNPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h @@ -75,7 +75,10 @@ public: */ const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& getTransitions() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const SinglePopNPDA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.cpp b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.cpp index 34228a0666..ec13165a9e 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.cpp +++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.cpp @@ -264,10 +264,6 @@ const std::map<std::pair<State, alphabet::Symbol>, State>& VisiblyPushdownDPDA:: return localTransitions; } -int VisiblyPushdownDPDA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int VisiblyPushdownDPDA::compare(const VisiblyPushdownDPDA& other) const { auto first = std::tie(states, callInputAlphabet, returnInputAlphabet, localInputAlphabet, initialState, finalStates, stackAlphabet, bottomOfTheStackSymbol, callTransitions, returnTransitions, localTransitions); auto second = std::tie(other.states, other.callInputAlphabet, other.returnInputAlphabet, other.localInputAlphabet, other.initialState, other.finalStates, other.stackAlphabet, other.bottomOfTheStackSymbol, other.callTransitions, other.returnTransitions, other.localTransitions); diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h index f44bf960fa..0aa8958edb 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h @@ -104,7 +104,10 @@ public: const std::map<std::pair<State, alphabet::Symbol>, State>& getLocalTransitions() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const VisiblyPushdownDPDA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.cpp b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.cpp index bb270a28e7..b953fedbbb 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.cpp +++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.cpp @@ -197,10 +197,6 @@ const std::map<std::pair<State, alphabet::Symbol>, std::set<State> >& VisiblyPus return localTransitions; } -int VisiblyPushdownNPDA::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int VisiblyPushdownNPDA::compare(const VisiblyPushdownNPDA& other) const { auto first = std::tie(states, callInputAlphabet, returnInputAlphabet, localInputAlphabet, initialStates, finalStates, stackAlphabet, bottomOfTheStackSymbol, callTransitions, returnTransitions, localTransitions); auto second = std::tie(other.states, other.callInputAlphabet, other.returnInputAlphabet, other.localInputAlphabet, other.initialStates, other.finalStates, other.stackAlphabet, other.bottomOfTheStackSymbol, other.callTransitions, other.returnTransitions, other.localTransitions); diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h index 6aa153fe96..3f22b8c4d2 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h @@ -104,7 +104,10 @@ public: const std::map<std::pair<State, alphabet::Symbol>, std::set<State> >& getLocalTransitions() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const VisiblyPushdownNPDA& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/automaton/TM/OneTapeDTM.cpp b/alib2data/src/automaton/TM/OneTapeDTM.cpp index 9951f1f2c3..45497fff24 100644 --- a/alib2data/src/automaton/TM/OneTapeDTM.cpp +++ b/alib2data/src/automaton/TM/OneTapeDTM.cpp @@ -114,10 +114,6 @@ const std::map<std::pair<State, alphabet::Symbol>, std::tuple<State, alphabet::S return transitions; } -int OneTapeDTM::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int OneTapeDTM::compare(const OneTapeDTM& other) const { auto first = std::tie(states, inputAlphabet, initialState, finalStates, tapeAlphabet, blankSymbol, transitions); auto second = std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.tapeAlphabet, other.blankSymbol, other.transitions); diff --git a/alib2data/src/automaton/TM/OneTapeDTM.h b/alib2data/src/automaton/TM/OneTapeDTM.h index c2590e3da0..0418689019 100644 --- a/alib2data/src/automaton/TM/OneTapeDTM.h +++ b/alib2data/src/automaton/TM/OneTapeDTM.h @@ -73,7 +73,10 @@ public: */ const std::map<std::pair<State, alphabet::Symbol>, std::tuple<State, alphabet::Symbol, Shift> >& getTransitions() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const OneTapeDTM& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/container/ObjectsMap.cpp b/alib2data/src/container/ObjectsMap.cpp index 9dfc2156b5..93f99f10cc 100644 --- a/alib2data/src/container/ObjectsMap.cpp +++ b/alib2data/src/container/ObjectsMap.cpp @@ -22,10 +22,6 @@ ContainerBase* ObjectsMap::plunder() && { return new ObjectsMap(std::move(*this)); } -int ObjectsMap::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int ObjectsMap::compare(const ObjectsMap& other) const { if(static_cast<const std::map<alib::Object, alib::Object>>(*this) == static_cast<const std::map<alib::Object, alib::Object>>(other)) { return 0; diff --git a/alib2data/src/container/ObjectsMap.h b/alib2data/src/container/ObjectsMap.h index 75864401db..de194f0937 100644 --- a/alib2data/src/container/ObjectsMap.h +++ b/alib2data/src/container/ObjectsMap.h @@ -26,7 +26,10 @@ public: virtual ContainerBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const ObjectsMap& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/container/ObjectsPair.cpp b/alib2data/src/container/ObjectsPair.cpp index b44b02887e..dc7efab163 100644 --- a/alib2data/src/container/ObjectsPair.cpp +++ b/alib2data/src/container/ObjectsPair.cpp @@ -26,10 +26,6 @@ ContainerBase* ObjectsPair::plunder() && { return new ObjectsPair(std::move(*this)); } -int ObjectsPair::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int ObjectsPair::compare(const ObjectsPair& other) const { if(static_cast<const std::pair<alib::Object, alib::Object>>(*this) == static_cast<const std::pair<alib::Object, alib::Object>>(other)) { return 0; diff --git a/alib2data/src/container/ObjectsPair.h b/alib2data/src/container/ObjectsPair.h index 65651ce1c3..28bd4a1289 100644 --- a/alib2data/src/container/ObjectsPair.h +++ b/alib2data/src/container/ObjectsPair.h @@ -28,7 +28,10 @@ public: virtual ContainerBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const ObjectsPair& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/container/ObjectsSet.cpp b/alib2data/src/container/ObjectsSet.cpp index 464e69e862..b68e4811e9 100644 --- a/alib2data/src/container/ObjectsSet.cpp +++ b/alib2data/src/container/ObjectsSet.cpp @@ -22,10 +22,6 @@ ContainerBase* ObjectsSet::plunder() && { return new ObjectsSet(std::move(*this)); } -int ObjectsSet::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int ObjectsSet::compare(const ObjectsSet& other) const { if(static_cast<const std::set<alib::Object>>(*this) == static_cast<const std::set<alib::Object>>(other)) { return 0; diff --git a/alib2data/src/container/ObjectsSet.h b/alib2data/src/container/ObjectsSet.h index c704bc77c1..4ee7de42c8 100644 --- a/alib2data/src/container/ObjectsSet.h +++ b/alib2data/src/container/ObjectsSet.h @@ -26,7 +26,10 @@ public: virtual ContainerBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const ObjectsSet& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/container/ObjectsVector.cpp b/alib2data/src/container/ObjectsVector.cpp index 9efb9292c9..9f02aa8cd2 100644 --- a/alib2data/src/container/ObjectsVector.cpp +++ b/alib2data/src/container/ObjectsVector.cpp @@ -22,10 +22,6 @@ ContainerBase* ObjectsVector::plunder() && { return new ObjectsVector(std::move(*this)); } -int ObjectsVector::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int ObjectsVector::compare(const ObjectsVector& other) const { if(static_cast<const std::vector<alib::Object>>(*this) == static_cast<const std::vector<alib::Object>>(other)) { return 0; diff --git a/alib2data/src/container/ObjectsVector.h b/alib2data/src/container/ObjectsVector.h index 7d372d2383..ca64be8673 100644 --- a/alib2data/src/container/ObjectsVector.h +++ b/alib2data/src/container/ObjectsVector.h @@ -26,7 +26,10 @@ public: virtual ContainerBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const ObjectsVector& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/exception/AlibException.cpp b/alib2data/src/exception/AlibException.cpp index 5373bb86b9..573c7a1efe 100644 --- a/alib2data/src/exception/AlibException.cpp +++ b/alib2data/src/exception/AlibException.cpp @@ -67,10 +67,6 @@ const std::string & AlibException::getBacktrace ( ) const { return backtrace; } -int AlibException::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int AlibException::compare(const AlibException& other) const { return this->whatMessage.compare(other.whatMessage); } diff --git a/alib2data/src/exception/AlibException.h b/alib2data/src/exception/AlibException.h index f68892c08f..7feee65081 100644 --- a/alib2data/src/exception/AlibException.h +++ b/alib2data/src/exception/AlibException.h @@ -53,7 +53,10 @@ public: */ const std::string & getBacktrace ( ) const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const AlibException& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/ContextFree/CFG.cpp b/alib2data/src/grammar/ContextFree/CFG.cpp index bab73c29f2..90cb0f31f4 100644 --- a/alib2data/src/grammar/ContextFree/CFG.cpp +++ b/alib2data/src/grammar/ContextFree/CFG.cpp @@ -89,10 +89,6 @@ bool CFG::removeRule(const alphabet::Symbol& leftHandSide, const std::vector<alp return rules[leftHandSide].erase(rightHandSide); } -int CFG::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int CFG::compare(const CFG& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/ContextFree/CFG.h b/alib2data/src/grammar/ContextFree/CFG.h index 720f5f89a3..f995b96a6a 100644 --- a/alib2data/src/grammar/ContextFree/CFG.h +++ b/alib2data/src/grammar/ContextFree/CFG.h @@ -47,7 +47,10 @@ public: bool removeNonterminalSymbol(const alphabet::Symbol& symbol); - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const CFG& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/ContextFree/CNF.cpp b/alib2data/src/grammar/ContextFree/CNF.cpp index 449f53d362..ade7d480bf 100644 --- a/alib2data/src/grammar/ContextFree/CNF.cpp +++ b/alib2data/src/grammar/ContextFree/CNF.cpp @@ -171,10 +171,6 @@ bool CNF::getGeneratesEpsilon() const { return generatesEpsilon; } -int CNF::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int CNF::compare(const CNF& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/ContextFree/CNF.h b/alib2data/src/grammar/ContextFree/CNF.h index eca8d06616..5e1ddfa933 100644 --- a/alib2data/src/grammar/ContextFree/CNF.h +++ b/alib2data/src/grammar/ContextFree/CNF.h @@ -56,7 +56,10 @@ public: void setGeneratesEpsilon(bool genEps); bool getGeneratesEpsilon() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const CNF& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp index 9a9c80c507..7263e40809 100644 --- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp +++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp @@ -122,10 +122,6 @@ bool EpsilonFreeCFG::getGeneratesEpsilon() const { return generatesEpsilon; } -int EpsilonFreeCFG::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int EpsilonFreeCFG::compare(const EpsilonFreeCFG& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h index 1f07c6f2bd..a5382fadb1 100644 --- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h +++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h @@ -51,7 +51,10 @@ public: void setGeneratesEpsilon(bool genEps); bool getGeneratesEpsilon() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const EpsilonFreeCFG& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/ContextFree/GNF.cpp b/alib2data/src/grammar/ContextFree/GNF.cpp index 93f6b393db..82a8751956 100644 --- a/alib2data/src/grammar/ContextFree/GNF.cpp +++ b/alib2data/src/grammar/ContextFree/GNF.cpp @@ -130,10 +130,6 @@ bool GNF::getGeneratesEpsilon() const { return generatesEpsilon; } -int GNF::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int GNF::compare(const GNF& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/ContextFree/GNF.h b/alib2data/src/grammar/ContextFree/GNF.h index da0fa45949..08b12ff8a6 100644 --- a/alib2data/src/grammar/ContextFree/GNF.h +++ b/alib2data/src/grammar/ContextFree/GNF.h @@ -48,9 +48,13 @@ public: bool removeNonterminalSymbol(const alphabet::Symbol& symbol); void setGeneratesEpsilon(bool genEps); + bool getGeneratesEpsilon() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const GNF& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/ContextFree/LG.cpp b/alib2data/src/grammar/ContextFree/LG.cpp index 03a2b0336f..afbdb2816a 100644 --- a/alib2data/src/grammar/ContextFree/LG.cpp +++ b/alib2data/src/grammar/ContextFree/LG.cpp @@ -180,10 +180,6 @@ bool LG::removeRawRule(const alphabet::Symbol& leftHandSide, const std::vector<a } } -int LG::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int LG::compare(const LG& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/ContextFree/LG.h b/alib2data/src/grammar/ContextFree/LG.h index 5e7a233d7c..322bac4bec 100644 --- a/alib2data/src/grammar/ContextFree/LG.h +++ b/alib2data/src/grammar/ContextFree/LG.h @@ -52,7 +52,10 @@ public: bool removeNonterminalSymbol(const alphabet::Symbol& symbol); - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const LG& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/ContextSensitive/CSG.cpp b/alib2data/src/grammar/ContextSensitive/CSG.cpp index 6f580f2f01..110e98fcec 100644 --- a/alib2data/src/grammar/ContextSensitive/CSG.cpp +++ b/alib2data/src/grammar/ContextSensitive/CSG.cpp @@ -119,10 +119,6 @@ bool CSG::getGeneratesEpsilon() const { return generatesEpsilon; } -int CSG::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int CSG::compare(const CSG& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/ContextSensitive/CSG.h b/alib2data/src/grammar/ContextSensitive/CSG.h index 15f7f56915..e4baa92f68 100644 --- a/alib2data/src/grammar/ContextSensitive/CSG.h +++ b/alib2data/src/grammar/ContextSensitive/CSG.h @@ -44,7 +44,10 @@ public: void setGeneratesEpsilon(bool genEps); bool getGeneratesEpsilon() const; - virtual int compare(const ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const CSG& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp index 44b8108f0c..76d215bf1a 100644 --- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp +++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp @@ -100,10 +100,6 @@ bool NonContractingGrammar::getGeneratesEpsilon() const { return generatesEpsilon; } -int NonContractingGrammar::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int NonContractingGrammar::compare(const NonContractingGrammar& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h index d89d141ec8..37e32edd57 100644 --- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h +++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h @@ -44,7 +44,10 @@ public: void setGeneratesEpsilon(bool genEps); bool getGeneratesEpsilon() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const NonContractingGrammar& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/Regular/LeftLG.cpp b/alib2data/src/grammar/Regular/LeftLG.cpp index b379a7208e..f5dfa37595 100644 --- a/alib2data/src/grammar/Regular/LeftLG.cpp +++ b/alib2data/src/grammar/Regular/LeftLG.cpp @@ -165,10 +165,6 @@ bool LeftLG::removeRawRule(const alphabet::Symbol& leftHandSide, const std::vect } } -int LeftLG::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int LeftLG::compare(const LeftLG& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/Regular/LeftLG.h b/alib2data/src/grammar/Regular/LeftLG.h index b7efe183de..1c662378e8 100644 --- a/alib2data/src/grammar/Regular/LeftLG.h +++ b/alib2data/src/grammar/Regular/LeftLG.h @@ -51,7 +51,10 @@ public: bool removeNonterminalSymbol(const alphabet::Symbol& symbol); - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const LeftLG& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/Regular/LeftRG.cpp b/alib2data/src/grammar/Regular/LeftRG.cpp index 1af289bbbb..9eaefcd56a 100644 --- a/alib2data/src/grammar/Regular/LeftRG.cpp +++ b/alib2data/src/grammar/Regular/LeftRG.cpp @@ -169,10 +169,6 @@ bool LeftRG::getGeneratesEpsilon() const { return generatesEpsilon; } -int LeftRG::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int LeftRG::compare(const LeftRG& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/Regular/LeftRG.h b/alib2data/src/grammar/Regular/LeftRG.h index 88e4c3a338..de7ddb40c6 100644 --- a/alib2data/src/grammar/Regular/LeftRG.h +++ b/alib2data/src/grammar/Regular/LeftRG.h @@ -124,7 +124,9 @@ public: /** * double dispatch operator helper */ - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } /** * compare diff --git a/alib2data/src/grammar/Regular/RightLG.cpp b/alib2data/src/grammar/Regular/RightLG.cpp index 6585010a01..837ef72420 100644 --- a/alib2data/src/grammar/Regular/RightLG.cpp +++ b/alib2data/src/grammar/Regular/RightLG.cpp @@ -165,10 +165,6 @@ bool RightLG::removeRawRule(const alphabet::Symbol& leftHandSide, const std::vec } } -int RightLG::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int RightLG::compare(const RightLG& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/Regular/RightLG.h b/alib2data/src/grammar/Regular/RightLG.h index d2ba02c50c..cef83c1fb4 100644 --- a/alib2data/src/grammar/Regular/RightLG.h +++ b/alib2data/src/grammar/Regular/RightLG.h @@ -51,7 +51,10 @@ public: bool removeNonterminalSymbol(const alphabet::Symbol& symbol); - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const RightLG& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/Regular/RightRG.cpp b/alib2data/src/grammar/Regular/RightRG.cpp index e89179b96d..2ebd043344 100644 --- a/alib2data/src/grammar/Regular/RightRG.cpp +++ b/alib2data/src/grammar/Regular/RightRG.cpp @@ -169,10 +169,6 @@ bool RightRG::getGeneratesEpsilon() const { return generatesEpsilon; } -int RightRG::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int RightRG::compare(const RightRG& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/Regular/RightRG.h b/alib2data/src/grammar/Regular/RightRG.h index eea1c9c595..d28cc62c79 100644 --- a/alib2data/src/grammar/Regular/RightRG.h +++ b/alib2data/src/grammar/Regular/RightRG.h @@ -71,7 +71,10 @@ public: void setGeneratesEpsilon(bool genEps); bool getGeneratesEpsilon() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const RightRG& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp index e10ea337dc..474a2c6a5a 100644 --- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp +++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp @@ -105,10 +105,6 @@ bool ContextPreservingUnrestrictedGrammar::removeRule(const std::vector<alphabet return rules[make_tuple(lContext, leftHandSide, rContext)].erase(rightHandSide); } -int ContextPreservingUnrestrictedGrammar::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int ContextPreservingUnrestrictedGrammar::compare(const ContextPreservingUnrestrictedGrammar& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h index 14c86b9ec2..4de7f9fd18 100644 --- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h +++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h @@ -40,7 +40,10 @@ public: bool removeNonterminalSymbol(const alphabet::Symbol& symbol); - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const ContextPreservingUnrestrictedGrammar& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp index 4bce0a3fc3..c70d74fe4c 100644 --- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp +++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp @@ -86,10 +86,6 @@ bool UnrestrictedGrammar::removeRule(const std::vector<alphabet::Symbol>& leftHa return rules[leftHandSide].erase(rightHandSide); } -int UnrestrictedGrammar::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int UnrestrictedGrammar::compare(const UnrestrictedGrammar& other) const { auto first = std::tie(terminalAlphabet, nonterminalAlphabet, initialSymbol, rules); auto second = std::tie(other.terminalAlphabet, other.nonterminalAlphabet, other.initialSymbol, other.rules); diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h index 2a445e12b0..bb77683355 100644 --- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h +++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h @@ -40,7 +40,10 @@ public: bool removeNonterminalSymbol(const alphabet::Symbol& symbol); - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const UnrestrictedGrammar& other) const; virtual void operator>>(std::ostream& os) const; diff --git a/alib2data/src/label/HexavigesimalLabel.cpp b/alib2data/src/label/HexavigesimalLabel.cpp index 1aa1a2e703..3c767facc4 100644 --- a/alib2data/src/label/HexavigesimalLabel.cpp +++ b/alib2data/src/label/HexavigesimalLabel.cpp @@ -26,10 +26,6 @@ int HexavigesimalLabel::getData() const { return hexavigesimal; } -int HexavigesimalLabel::compare(const alib::ObjectBase& other) const { - return -other.compare(*this); -} - int HexavigesimalLabel::compare(const HexavigesimalLabel& other) const { return hexavigesimal - other.hexavigesimal; } diff --git a/alib2data/src/label/HexavigesimalLabel.h b/alib2data/src/label/HexavigesimalLabel.h index 2987991840..465524b3c1 100644 --- a/alib2data/src/label/HexavigesimalLabel.h +++ b/alib2data/src/label/HexavigesimalLabel.h @@ -38,7 +38,10 @@ public: */ int getData() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const HexavigesimalLabel& other) const; virtual void operator>>(std::ostream&) const; diff --git a/alib2data/src/label/LabelPairLabel.cpp b/alib2data/src/label/LabelPairLabel.cpp index 5b7c485203..55f8d2d78e 100644 --- a/alib2data/src/label/LabelPairLabel.cpp +++ b/alib2data/src/label/LabelPairLabel.cpp @@ -31,10 +31,6 @@ const std::pair<Label, Label>& LabelPairLabel::getData() const { return label; } -int LabelPairLabel::compare(const alib::ObjectBase& other) const { - return -other.compare(*this); -} - int LabelPairLabel::compare(const LabelPairLabel& other) const { int res = label.first.getData().compare(other.label.first.getData()); if(res == 0) res = label.second.getData().compare(other.label.second.getData()); diff --git a/alib2data/src/label/LabelPairLabel.h b/alib2data/src/label/LabelPairLabel.h index e2d9a8ddcc..0c01b4228e 100644 --- a/alib2data/src/label/LabelPairLabel.h +++ b/alib2data/src/label/LabelPairLabel.h @@ -42,7 +42,10 @@ public: */ const std::pair<Label, Label>& getData() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const LabelPairLabel& other) const; virtual void operator>>(std::ostream&) const; diff --git a/alib2data/src/label/LabelSetLabel.cpp b/alib2data/src/label/LabelSetLabel.cpp index 81c5225a29..012c687376 100644 --- a/alib2data/src/label/LabelSetLabel.cpp +++ b/alib2data/src/label/LabelSetLabel.cpp @@ -31,10 +31,6 @@ const std::set<Label>& LabelSetLabel::getData() const { return label; } -int LabelSetLabel::compare(const alib::ObjectBase& other) const { - return -other.compare(*this); -} - int LabelSetLabel::compare(const LabelSetLabel& other) const { if(label == other.label) { return 0; diff --git a/alib2data/src/label/LabelSetLabel.h b/alib2data/src/label/LabelSetLabel.h index 951d106b9c..f9e393ef6b 100644 --- a/alib2data/src/label/LabelSetLabel.h +++ b/alib2data/src/label/LabelSetLabel.h @@ -42,7 +42,10 @@ public: */ const std::set<Label>& getData() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const LabelSetLabel& other) const; virtual void operator>>(std::ostream&) const; diff --git a/alib2data/src/label/ObjectLabel.cpp b/alib2data/src/label/ObjectLabel.cpp index 985115b3e7..e07535061e 100644 --- a/alib2data/src/label/ObjectLabel.cpp +++ b/alib2data/src/label/ObjectLabel.cpp @@ -29,10 +29,6 @@ const alib::Object& ObjectLabel::getData() const { return label; } -int ObjectLabel::compare(const alib::ObjectBase& other) const { - return -other.compare(*this); -} - int ObjectLabel::compare(const ObjectLabel& other) const { return label.getData().compare(other.label.getData()); } diff --git a/alib2data/src/label/ObjectLabel.h b/alib2data/src/label/ObjectLabel.h index f57b0553d9..b435aeda59 100644 --- a/alib2data/src/label/ObjectLabel.h +++ b/alib2data/src/label/ObjectLabel.h @@ -40,7 +40,9 @@ public: */ const alib::Object& getData() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } virtual int compare(const ObjectLabel& other) const; diff --git a/alib2data/src/label/PrimitiveLabel.cpp b/alib2data/src/label/PrimitiveLabel.cpp index 35f63ae282..cabddfc856 100644 --- a/alib2data/src/label/PrimitiveLabel.cpp +++ b/alib2data/src/label/PrimitiveLabel.cpp @@ -29,10 +29,6 @@ const primitive::Primitive& PrimitiveLabel::getData() const { return primitive; } -int PrimitiveLabel::compare(const alib::ObjectBase& other) const { - return -other.compare(*this); -} - int PrimitiveLabel::compare(const PrimitiveLabel& other) const { return primitive.getData().compare(other.primitive.getData()); } diff --git a/alib2data/src/label/PrimitiveLabel.h b/alib2data/src/label/PrimitiveLabel.h index ed447b33ce..b783b06698 100644 --- a/alib2data/src/label/PrimitiveLabel.h +++ b/alib2data/src/label/PrimitiveLabel.h @@ -40,7 +40,10 @@ public: */ const primitive::Primitive& getData() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const PrimitiveLabel& other) const; virtual void operator>>(std::ostream&) const; diff --git a/alib2data/src/object/Void.cpp b/alib2data/src/object/Void.cpp index 4476934083..2d539d67b7 100644 --- a/alib2data/src/object/Void.cpp +++ b/alib2data/src/object/Void.cpp @@ -21,10 +21,6 @@ ObjectBase* Void::plunder() && { return new Void(std::move(*this)); } -int Void::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int Void::compare(const Void&) const { return 0; } diff --git a/alib2data/src/object/Void.h b/alib2data/src/object/Void.h index 7a47c43f9b..6c2eedcb35 100644 --- a/alib2data/src/object/Void.h +++ b/alib2data/src/object/Void.h @@ -28,7 +28,10 @@ public: virtual ObjectBase* clone() const; virtual ObjectBase* plunder() &&; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const Void& other) const; virtual void operator>>(std::ostream& out) const; diff --git a/alib2data/src/primitive/Character.cpp b/alib2data/src/primitive/Character.cpp index 925d7da08b..1182a4bf6b 100644 --- a/alib2data/src/primitive/Character.cpp +++ b/alib2data/src/primitive/Character.cpp @@ -25,10 +25,6 @@ char Character::getData() const { return data; } -int Character::compare(const alib::ObjectBase& other) const { - return -other.compare(*this); -} - int Character::compare(const Character& other) const { return data - other.data; } diff --git a/alib2data/src/primitive/Character.h b/alib2data/src/primitive/Character.h index 2edfe63ce5..842a21a4f5 100644 --- a/alib2data/src/primitive/Character.h +++ b/alib2data/src/primitive/Character.h @@ -38,7 +38,10 @@ public: */ char getData() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const Character& other) const; virtual void operator>>(std::ostream&) const; diff --git a/alib2data/src/primitive/Integer.cpp b/alib2data/src/primitive/Integer.cpp index 45635444cc..70bc8e335d 100644 --- a/alib2data/src/primitive/Integer.cpp +++ b/alib2data/src/primitive/Integer.cpp @@ -25,10 +25,6 @@ int Integer::getData() const { return data; } -int Integer::compare(const alib::ObjectBase& other) const { - return -other.compare(*this); -} - int Integer::compare(const Integer& other) const { return data - other.data; } diff --git a/alib2data/src/primitive/Integer.h b/alib2data/src/primitive/Integer.h index 0b71a0c33f..42aedfd087 100644 --- a/alib2data/src/primitive/Integer.h +++ b/alib2data/src/primitive/Integer.h @@ -37,7 +37,9 @@ public: */ int getData() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } virtual int compare(const Integer& other) const; diff --git a/alib2data/src/primitive/String.cpp b/alib2data/src/primitive/String.cpp index 659b031045..5fcc6edb63 100644 --- a/alib2data/src/primitive/String.cpp +++ b/alib2data/src/primitive/String.cpp @@ -29,10 +29,6 @@ const std::string& String::getData() const { return data; } -int String::compare(const alib::ObjectBase& other) const { - return -other.compare(*this); -} - int String::compare(const String& other) const { return data.compare(other.data); } diff --git a/alib2data/src/primitive/String.h b/alib2data/src/primitive/String.h index 1dc3f12965..83bde177e8 100644 --- a/alib2data/src/primitive/String.h +++ b/alib2data/src/primitive/String.h @@ -40,7 +40,9 @@ public: */ const std::string& getData() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } virtual int compare(const String& other) const; diff --git a/alib2data/src/regexp/formal/FormalRegExp.cpp b/alib2data/src/regexp/formal/FormalRegExp.cpp index 6f5ef888db..c5911cf80e 100644 --- a/alib2data/src/regexp/formal/FormalRegExp.cpp +++ b/alib2data/src/regexp/formal/FormalRegExp.cpp @@ -142,10 +142,6 @@ void FormalRegExp::operator >>(std::ostream& out) const { out << "(FormalRegExp " << *(this->regExp) << ")"; } -int FormalRegExp::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int FormalRegExp::compare(const FormalRegExp& other) const { int res = regExp->compare(*other.regExp); if(res == 0) { diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h index c8045b63e2..7a283401c7 100644 --- a/alib2data/src/regexp/formal/FormalRegExp.h +++ b/alib2data/src/regexp/formal/FormalRegExp.h @@ -112,7 +112,10 @@ public: */ virtual void operator>>(std::ostream& out) const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const FormalRegExp& other) const; virtual operator std::string() const; diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp b/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp index d6cae69d65..622910ba0a 100644 --- a/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp @@ -128,10 +128,6 @@ UnboundedRegExpElement* FormalRegExpAlternation::cloneAsUnbounded() const { return res; } -int FormalRegExpAlternation::compare(const FormalRegExpElement& other) const { - return -other.compare(*this); -} - int FormalRegExpAlternation::compare(const FormalRegExpAlternation& other) const { int res = left->compare(*other.left); if(res == 0) res = right->compare(*other.right); diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.h b/alib2data/src/regexp/formal/FormalRegExpAlternation.h index 5d4e51bdb1..b31853b98f 100644 --- a/alib2data/src/regexp/formal/FormalRegExpAlternation.h +++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.h @@ -92,7 +92,10 @@ public: void setRightElement(const FormalRegExpElement& element); void setRightElement(FormalRegExpElement&& element); - virtual int compare(const FormalRegExpElement&) const; + virtual int compare(const FormalRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const FormalRegExpAlternation&) const; /** diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp index 5eb76c295e..9dee89ae1e 100644 --- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp @@ -127,10 +127,6 @@ FormalRegExpElement* FormalRegExpConcatenation::plunder() && { return new FormalRegExpConcatenation(std::move(*this)); } -int FormalRegExpConcatenation::compare(const FormalRegExpElement& other) const { - return -other.compare(*this); -} - int FormalRegExpConcatenation::compare(const FormalRegExpConcatenation& other) const { int res = left->compare(*other.left); if(res == 0) res = right->compare(*other.right); diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h index ca2463c3bc..0b53a274e7 100644 --- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h +++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h @@ -90,7 +90,10 @@ public: void setRightElement(const FormalRegExpElement& element); void setRightElement(FormalRegExpElement&& element); - virtual int compare(const FormalRegExpElement&) const; + virtual int compare(const FormalRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const FormalRegExpConcatenation&) const; /** diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp b/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp index 964ac14ea6..e9762b674e 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp @@ -44,10 +44,6 @@ UnboundedRegExpElement* FormalRegExpEmpty::cloneAsUnbounded() const { return new UnboundedRegExpEmpty(); } -int FormalRegExpEmpty::compare(const FormalRegExpElement& other) const { - return -other.compare(*this); -} - int FormalRegExpEmpty::compare(const FormalRegExpEmpty&) const { return 0; } diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.h b/alib2data/src/regexp/formal/FormalRegExpEmpty.h index 94fe4f5129..f4825479d5 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEmpty.h +++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.h @@ -55,7 +55,10 @@ public: */ virtual FormalRegExpElement* plunder() &&; - virtual int compare(const FormalRegExpElement&) const; + virtual int compare(const FormalRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const FormalRegExpEmpty&) const; /** diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp b/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp index ad3414027f..63f85748df 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp @@ -45,10 +45,6 @@ UnboundedRegExpElement* FormalRegExpEpsilon::cloneAsUnbounded() const { return new UnboundedRegExpEpsilon(); } -int FormalRegExpEpsilon::compare(const FormalRegExpElement& other) const { - return -other.compare(*this); -} - int FormalRegExpEpsilon::compare(const FormalRegExpEpsilon&) const { return 0; } diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h index 6ab5146a97..72c32e5afb 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h +++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h @@ -56,7 +56,10 @@ public: */ virtual FormalRegExpElement* plunder() &&; - virtual int compare(const FormalRegExpElement&) const; + virtual int compare(const FormalRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const FormalRegExpEpsilon&) const; /** diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.cpp b/alib2data/src/regexp/formal/FormalRegExpIteration.cpp index 785f8543ca..1eef7c4858 100644 --- a/alib2data/src/regexp/formal/FormalRegExpIteration.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpIteration.cpp @@ -93,10 +93,6 @@ UnboundedRegExpElement* FormalRegExpIteration::cloneAsUnbounded() const { return res; } -int FormalRegExpIteration::compare(const FormalRegExpElement& other) const { - return -other.compare(*this); -} - int FormalRegExpIteration::compare(const FormalRegExpIteration& other) const { return element->compare(*other.element); } diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.h b/alib2data/src/regexp/formal/FormalRegExpIteration.h index 830d6e8562..ccd265a4b8 100644 --- a/alib2data/src/regexp/formal/FormalRegExpIteration.h +++ b/alib2data/src/regexp/formal/FormalRegExpIteration.h @@ -85,7 +85,10 @@ public: void setElement(FormalRegExpElement&& element); - virtual int compare(const FormalRegExpElement&) const; + virtual int compare(const FormalRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const FormalRegExpIteration&) const; /** diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp b/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp index ef8ec7f7ee..e2c1b55474 100644 --- a/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp @@ -78,10 +78,6 @@ bool operator==(const alphabet::Symbol& first, const FormalRegExpSymbol& second) return first == second.symbol; } -int FormalRegExpSymbol::compare(const FormalRegExpElement& other) const { - return -other.compare(*this); -} - int FormalRegExpSymbol::compare(const FormalRegExpSymbol& other) const { return symbol.getData().compare(other.symbol.getData()); } diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.h b/alib2data/src/regexp/formal/FormalRegExpSymbol.h index 110adea9af..f504607179 100644 --- a/alib2data/src/regexp/formal/FormalRegExpSymbol.h +++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.h @@ -67,7 +67,10 @@ public: bool operator==(const alphabet::Symbol&) const; friend bool operator==(const alphabet::Symbol&, const FormalRegExpSymbol&); - virtual int compare(const FormalRegExpElement&) const; + virtual int compare(const FormalRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const FormalRegExpSymbol&) const; /** diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExp.cpp index 77a3ddb744..c9ad463d31 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExp.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.cpp @@ -142,10 +142,6 @@ void UnboundedRegExp::operator >>(std::ostream& out) const { out << "(UnboundedRegExp " << *(this->regExp) << ")"; } -int UnboundedRegExp::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int UnboundedRegExp::compare(const UnboundedRegExp& other) const { int res = regExp->compare(*other.regExp); if(res == 0) { diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.h b/alib2data/src/regexp/unbounded/UnboundedRegExp.h index e6f3d531e7..63c6f44838 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExp.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.h @@ -112,7 +112,10 @@ public: */ virtual void operator>>(std::ostream& out) const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } + virtual int compare(const UnboundedRegExp& other) const; virtual operator std::string() const; diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp index b81cb5a0f6..1df63332c4 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp @@ -108,10 +108,6 @@ FormalRegExpElement* UnboundedRegExpAlternation::cloneAsFormal() const { return res; } -int UnboundedRegExpAlternation::compare(const UnboundedRegExpElement& other) const { - return -other.compare(*this); -} - int UnboundedRegExpAlternation::compare(const UnboundedRegExpAlternation& other) const { int thisSize = this->elements.size(); int otherSize = other.elements.size(); diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h index 669d29d913..f2c2faf69b 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h @@ -86,7 +86,10 @@ public: */ void appendElement(UnboundedRegExpElement&& element); - virtual int compare(const UnboundedRegExpElement&) const; + virtual int compare(const UnboundedRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const UnboundedRegExpAlternation&) const; /** diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp index a632d5bcac..334d1c1e8d 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp @@ -107,10 +107,6 @@ FormalRegExpElement* UnboundedRegExpConcatenation::cloneAsFormal() const { return res; } -int UnboundedRegExpConcatenation::compare(const UnboundedRegExpElement& other) const { - return -other.compare(*this); -} - int UnboundedRegExpConcatenation::compare(const UnboundedRegExpConcatenation& other) const { int thisSize = this->elements.size(); int otherSize = other.elements.size(); diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h index c69543fc03..bee29e7164 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h @@ -85,7 +85,10 @@ public: void appendElement(UnboundedRegExpElement&& element); - virtual int compare(const UnboundedRegExpElement&) const; + virtual int compare(const UnboundedRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const UnboundedRegExpConcatenation&) const; /** diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp index 893ab6b978..ca5c670c85 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp @@ -45,10 +45,6 @@ FormalRegExpElement* UnboundedRegExpEmpty::cloneAsFormal() const { return new FormalRegExpEmpty(); } -int UnboundedRegExpEmpty::compare(const UnboundedRegExpElement& other) const { - return -other.compare(*this); -} - int UnboundedRegExpEmpty::compare(const UnboundedRegExpEmpty&) const { return 0; } diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h index eff46b8832..d978c92b90 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h @@ -54,7 +54,10 @@ public: */ virtual UnboundedRegExpElement* plunder() &&; - virtual int compare(const UnboundedRegExpElement&) const; + virtual int compare(const UnboundedRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const UnboundedRegExpEmpty&) const; /** diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp index c1662b17e3..964d1dd1d9 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp @@ -45,10 +45,6 @@ FormalRegExpElement* UnboundedRegExpEpsilon::cloneAsFormal() const { return new FormalRegExpEpsilon(); } -int UnboundedRegExpEpsilon::compare(const UnboundedRegExpElement& other) const { - return -other.compare(*this); -} - int UnboundedRegExpEpsilon::compare(const UnboundedRegExpEpsilon&) const { return 0; } diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h index 974a276582..ef72a8d2b3 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h @@ -54,9 +54,11 @@ public: * @copydoc UnboundedRegExpElement::plunder() const */ virtual UnboundedRegExpElement* plunder() &&; - - - virtual int compare(const UnboundedRegExpElement&) const; + + virtual int compare(const UnboundedRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const UnboundedRegExpEpsilon&) const; /** diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp index 2e59769638..2b139cabb6 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp @@ -93,10 +93,6 @@ FormalRegExpElement* UnboundedRegExpIteration::cloneAsFormal() const { return res; } -int UnboundedRegExpIteration::compare(const UnboundedRegExpElement& other) const { - return -other.compare(*this); -} - int UnboundedRegExpIteration::compare(const UnboundedRegExpIteration& other) const { return element->compare(*other.element); } diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h index 30bf2f8fe3..1c37dd4754 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h @@ -84,7 +84,10 @@ public: void setElement(UnboundedRegExpElement&& element); - virtual int compare(const UnboundedRegExpElement&) const; + virtual int compare(const UnboundedRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const UnboundedRegExpIteration&) const; /** diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp index f06d1c1686..47e5e49ad0 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp @@ -78,10 +78,6 @@ bool operator==(const alphabet::Symbol& first, const UnboundedRegExpSymbol& seco return first == second.symbol; } -int UnboundedRegExpSymbol::compare(const UnboundedRegExpElement& other) const { - return -other.compare(*this); -} - int UnboundedRegExpSymbol::compare(const UnboundedRegExpSymbol& other) const { return symbol.getData().compare(other.symbol.getData()); } diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h index 8491667ba3..b567b01d04 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h @@ -66,7 +66,10 @@ public: bool operator==(const alphabet::Symbol&) const; friend bool operator==(const alphabet::Symbol&, const UnboundedRegExpSymbol&); - virtual int compare(const UnboundedRegExpElement&) const; + virtual int compare(const UnboundedRegExpElement& other) const { + return -other.compare(*this); + } + virtual int compare(const UnboundedRegExpSymbol&) const; /** diff --git a/alib2data/src/string/CyclicString.cpp b/alib2data/src/string/CyclicString.cpp index 9ff586a65a..d78d72bedc 100644 --- a/alib2data/src/string/CyclicString.cpp +++ b/alib2data/src/string/CyclicString.cpp @@ -89,10 +89,6 @@ bool CyclicString::isEmpty() const { return this->m_Data.size() == 0; } -int CyclicString::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int CyclicString::compare(const LinearString& other) const { if(this->isEmpty() && other.isEmpty()) { if(alphabet == other.getAlphabet()) diff --git a/alib2data/src/string/CyclicString.h b/alib2data/src/string/CyclicString.h index 0d1113a665..2026c6f1d5 100644 --- a/alib2data/src/string/CyclicString.h +++ b/alib2data/src/string/CyclicString.h @@ -52,7 +52,9 @@ public: */ bool isEmpty() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } virtual int compare(const LinearString& other) const; virtual int compare(const CyclicString& other) const; diff --git a/alib2data/src/string/Epsilon.cpp b/alib2data/src/string/Epsilon.cpp index 9430ab4047..620c4a81f3 100644 --- a/alib2data/src/string/Epsilon.cpp +++ b/alib2data/src/string/Epsilon.cpp @@ -34,10 +34,6 @@ bool Epsilon::isEmpty() const { return true; } -int Epsilon::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int Epsilon::compare(const Epsilon& other) const { if(alphabet == other.alphabet) return 0; diff --git a/alib2data/src/string/Epsilon.h b/alib2data/src/string/Epsilon.h index 0a2e4b3a2e..e25f4806b6 100644 --- a/alib2data/src/string/Epsilon.h +++ b/alib2data/src/string/Epsilon.h @@ -40,7 +40,9 @@ public: */ bool isEmpty() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } virtual int compare(const LinearString& other) const; virtual int compare(const CyclicString& other) const; diff --git a/alib2data/src/string/LinearString.cpp b/alib2data/src/string/LinearString.cpp index 082475acc2..7f66a4839a 100644 --- a/alib2data/src/string/LinearString.cpp +++ b/alib2data/src/string/LinearString.cpp @@ -100,10 +100,6 @@ bool LinearString::isEmpty() const { return this->m_Data.size() == 0; } -int LinearString::compare(const ObjectBase& other) const { - return -other.compare(*this); -} - int LinearString::compare(const LinearString& other) const { auto first = std::tie(m_Data, alphabet); auto second = std::tie(other.m_Data, other.alphabet); diff --git a/alib2data/src/string/LinearString.h b/alib2data/src/string/LinearString.h index a6921c5225..ee463d1ea4 100644 --- a/alib2data/src/string/LinearString.h +++ b/alib2data/src/string/LinearString.h @@ -60,7 +60,9 @@ public: */ bool isEmpty() const; - virtual int compare(const alib::ObjectBase& other) const; + virtual int compare(const ObjectBase& other) const { + return -other.compare(*this); + } virtual int compare(const LinearString& other) const; virtual int compare(const CyclicString& other) const; -- GitLab