diff --git a/alib2data/src/alphabet/BarSymbol.h b/alib2data/src/alphabet/BarSymbol.h index 1c76552091a4bb5f1e0315f72a828d443ee436e5..ed84a2e9d2fdde0d874148d5c6efd22de7935aaf 100644 --- a/alib2data/src/alphabet/BarSymbol.h +++ b/alib2data/src/alphabet/BarSymbol.h @@ -1,6 +1,22 @@ /* * BarSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Apr 10, 2013 * Author: Stepan Plachy */ @@ -16,36 +32,70 @@ namespace alphabet { /** - * Represents bar symbol for tree linearization. + * \brief + * Represents bar symbol used in tree linearization. */ class BarSymbol : public SymbolBase { public: /** - * Creates a bar symbol. - * @param symbol name of the symbol + * \brief + * Creates a new instance of the symbol. */ explicit BarSymbol ( ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const BarSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < std::is_integral < Base >::value, Base >::type instance ( ); + + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < ! std::is_integral < Base >::value, Base >::type instance ( ); + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/BlankSymbol.h b/alib2data/src/alphabet/BlankSymbol.h index 8872d0ceb0c8bf2eba842826abb8bdb5726f6d0d..1eb01b89e065a06948bb75639ac2d66ae8d99e6e 100644 --- a/alib2data/src/alphabet/BlankSymbol.h +++ b/alib2data/src/alphabet/BlankSymbol.h @@ -1,6 +1,22 @@ /* * BlankSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ @@ -16,36 +32,70 @@ namespace alphabet { /** - * Represents blank symbol in an alphabet. + * \brief + * Represents blank symbol used in the turing machine. */ class BlankSymbol : public SymbolBase { public: /** - * Creates a blank symbol. - * @param symbol name of the symbol + * \brief + * Creates a new instance of the symbol. */ explicit BlankSymbol ( ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const BlankSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < std::is_integral < Base >::value, Base >::type instance ( ); + + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < ! std::is_integral < Base >::value, Base >::type instance ( ); + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.h b/alib2data/src/alphabet/BottomOfTheStackSymbol.h index 17f79e95d5998b7d711303ae4011c04e2f67f3e8..6fd23d73878cd3dc26f97d9291e0c249f3fccad3 100644 --- a/alib2data/src/alphabet/BottomOfTheStackSymbol.h +++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.h @@ -1,6 +1,22 @@ /* * BottomOfTheStackSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Jun 19, 2014 * Author: Jan Travnicek */ @@ -16,36 +32,70 @@ namespace alphabet { /** - * Represents blank symbol in an alphabet. + * \brief + * Represents bottom of the stack symbol used in the visibly pushdown automata. */ class BottomOfTheStackSymbol : public SymbolBase { public: /** - * Creates a blank symbol. - * @param symbol name of the symbol + * \brief + * Creates a new instance of the symbol. */ explicit BottomOfTheStackSymbol ( ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const BottomOfTheStackSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < std::is_integral < Base >::value, Base >::type instance ( ); + + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < ! std::is_integral < Base >::value, Base >::type instance ( ); + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/EndSymbol.h b/alib2data/src/alphabet/EndSymbol.h index 88ec81d2965bb5e86928a45ac3d36b71627686ef..fa623e62a1a2c60e5e1beca9a47911d8f1f1aa9c 100644 --- a/alib2data/src/alphabet/EndSymbol.h +++ b/alib2data/src/alphabet/EndSymbol.h @@ -1,6 +1,22 @@ /* * EndSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Jun 19, 2014 * Author: Jan Travnicek */ @@ -16,36 +32,70 @@ namespace alphabet { /** - * Represents blank symbol in an alphabet. + * \brief + * Represents end symbol used as termation symbol of a string. */ class EndSymbol : public SymbolBase { public: /** - * Creates a blank symbol. - * @param symbol name of the symbol + * \brief + * Creates a new instance of the symbol. */ explicit EndSymbol ( ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const EndSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < std::is_integral < Base >::value, Base >::type instance ( ); + + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < ! std::is_integral < Base >::value, Base >::type instance ( ); + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/InitialSymbol.h b/alib2data/src/alphabet/InitialSymbol.h index 1e4bf6665e4e2086e34323b5fefc7188a8e94885..8e2749d79154985da8c04be805734d1b326fc738 100644 --- a/alib2data/src/alphabet/InitialSymbol.h +++ b/alib2data/src/alphabet/InitialSymbol.h @@ -1,6 +1,22 @@ /* * InitialSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ @@ -16,37 +32,70 @@ namespace alphabet { /** - * Represents symbol in an alphabet. + * \brief + * Represents initial symbol used as an initial symbol of a grammar. */ class InitialSymbol : public SymbolBase { public: /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates a new instance of the symbol. */ explicit InitialSymbol ( ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const InitialSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < std::is_integral < Base >::value, Base >::type instance ( ); + + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < ! std::is_integral < Base >::value, Base >::type instance ( ); + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/LabeledSymbol.h b/alib2data/src/alphabet/LabeledSymbol.h index e4f9593545a8f035cd8156ad9f8ac59d32a64ebc..a5716d19f13cb2607d7848047672493743380411 100644 --- a/alib2data/src/alphabet/LabeledSymbol.h +++ b/alib2data/src/alphabet/LabeledSymbol.h @@ -1,6 +1,22 @@ /* * LabeledSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Martin Zak */ @@ -14,45 +30,97 @@ namespace alphabet { /** - * Represents symbol in an alphabet. + * \brief + * \depricated + * Represents labeled symbol used as a wrapper of label. */ class LabeledSymbol : public SymbolBase { -protected: + /** + * \brief + * The label of the symbol. + */ label::Label m_label; public: + /** + * \brief + * Creates a new instance of the symbol with integer label. + */ explicit LabeledSymbol ( int number ); + + /** + * \brief + * Creates a new instance of the symbol with character label. + */ explicit LabeledSymbol ( char character ); + + /** + * \brief + * Creates a new instance of the symbol with string label. + */ explicit LabeledSymbol ( std::string label ); /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates a new instance of the symbol with preexistent label. */ explicit LabeledSymbol ( label::Label label ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; /** - * @return name of the symbol + * Getter of the symbol's label. + * + * \return the label of the symbol */ const label::Label & getLabel ( ) const &; + /** + * Getter of the symbol's label. + * + * \return the label of the symbol + */ label::Label && getLabel ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const LabeledSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/NonlinearVariableSymbol.h b/alib2data/src/alphabet/NonlinearVariableSymbol.h index e454590ab448703f2fa7cf475a48eb01858bca6d..94b91aae67fa5033f477d5787964e01c952f66e0 100644 --- a/alib2data/src/alphabet/NonlinearVariableSymbol.h +++ b/alib2data/src/alphabet/NonlinearVariableSymbol.h @@ -1,6 +1,22 @@ /* * NonlinearVariableSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Apr 10, 2013 * Author: Jan Travnicek */ @@ -19,40 +35,78 @@ namespace alphabet { /** - * Represents subtreeWildcard symbol for tree linearization. + * \brief + * Represents the nonlinear variable symbol used in a nonlinear tree pattern. */ template < class SymbolType > class NonlinearVariableSymbol : public SymbolBase { + /** + * \brief the symbol of the nonlinear variable. + */ SymbolType m_symbol; public: + /** + * \brief + * Creates a new instance of the nonlinear variable with some underlying base symbol. + */ explicit NonlinearVariableSymbol ( SymbolType symbol ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; /** - * @return name of the symbol + * Getter of the nonlinear variable's symbol + * + * \return the symbol of the nonlinear variable */ const SymbolType & getSymbol ( ) const &; /** - * @return name of the symbol + * Getter of the nonlinear variable's symbol + * + * \return the symbol of the nonlinear variable */ SymbolType && getSymbol ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const NonlinearVariableSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/RankedSymbol.h b/alib2data/src/alphabet/RankedSymbol.h index 59eddd8af32e9660a395221c0c32cce1627b3015..74001c2cd2c0ac0e65bfc16892943345b7e1768b 100644 --- a/alib2data/src/alphabet/RankedSymbol.h +++ b/alib2data/src/alphabet/RankedSymbol.h @@ -1,6 +1,22 @@ /* * RankedSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Apr 10, 2013 * Author: Stepan Plachy */ @@ -19,38 +35,99 @@ namespace alphabet { /** - * Represents symbol in an alphabet. + * \brief + * Represents the adaptor of ranked symbol to class in symbol hierarchy. + * + * \tparam SymbolType used for the symbol part of the ranked symbol + * \tparam RankType used for the rank part of the ranked symbol */ template < class SymbolType, class RankType > class RankedSymbol : public SymbolBase, public common::ranked_symbol < SymbolType, RankType > { public: + /** + * \brief + * The constructors of raw ranked symbol are inherited here + */ using common::ranked_symbol < SymbolType, RankType >::ranked_symbol; + /** + * \brief + * Creates a new instance of the ranked symbol based on a raw ranked symbol + */ explicit RankedSymbol ( common::ranked_symbol < SymbolType, RankType > symbol ) : common::ranked_symbol < SymbolType, RankType > ( std::move ( symbol ) ) { } + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const RankedSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * @copydoc base::CommonBaseMiddle < ObjectBase >::operator == + */ using SymbolBase::operator ==; + + /** + * @copydoc base::CommonBaseMiddle < ObjectBase >::operator != + */ using SymbolBase::operator !=; + + /** + * @copydoc base::CommonBaseMiddle < ObjectBase >::operator < + */ using SymbolBase::operator <; + + /** + * @copydoc base::CommonBaseMiddle < ObjectBase >::operator <= + */ using SymbolBase::operator <=; + + /** + * @copydoc base::CommonBaseMiddle < ObjectBase >::operator > + */ using SymbolBase::operator >; + + /** + * @copydoc base::CommonBaseMiddle < ObjectBase >::operator >= + */ using SymbolBase::operator >=; + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/StartSymbol.h b/alib2data/src/alphabet/StartSymbol.h index 8b8546f3132511f24ede1a1c3cd08d4988d45738..5ea4b4d88a897767617805031a0b1873f6b82116 100644 --- a/alib2data/src/alphabet/StartSymbol.h +++ b/alib2data/src/alphabet/StartSymbol.h @@ -1,6 +1,22 @@ /* * StartSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Jun 19, 2014 * Author: Jan Travnicek */ @@ -16,36 +32,70 @@ namespace alphabet { /** - * Represents blank symbol in an alphabet. + * \brief + * Represents start symbol used as initializing symbol of a string. */ class StartSymbol : public SymbolBase { public: /** - * Creates a blank symbol. - * @param symbol name of the symbol + * \brief + * Creates a new instance of the symbol. */ explicit StartSymbol ( ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const StartSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < std::is_integral < Base >::value, Base >::type instance ( ); + + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < ! std::is_integral < Base >::value, Base >::type instance ( ); + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/UniqueSymbol.h b/alib2data/src/alphabet/UniqueSymbol.h index 50a9a00b2b81707063ddc1a76d56224b1396f52d..174566a1465300c0814ea72baaabb11bb07551a5 100644 --- a/alib2data/src/alphabet/UniqueSymbol.h +++ b/alib2data/src/alphabet/UniqueSymbol.h @@ -1,6 +1,22 @@ /* * UniqueSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ @@ -14,47 +30,103 @@ namespace alphabet { /** - * Represents symbol in an alphabet. + * \brief + * Represents symbol based on other symbol with additional differentiation counter. + * + * The UniqueSymbol is used in situations when some symbol is given and one would like to create new based on it but different. For example q vs. q' vs q'', etc. + * + * Primarly the class is used from inc method. */ class UniqueSymbol : public SymbolBase { -protected: + /** + * The underlying symbol. + */ Symbol m_symbol; + + /** + * The differentiating number. + */ primitive::Integer m_id; public: /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates new symbol with given name and set differentiating number. + * + * \param symbol the underlying symbol + * \param id the differentiating number */ explicit UniqueSymbol ( Symbol symbol, primitive::Integer id ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; /** - * @return name of the symbol + * Getter of the underlying symbol. + * + * \return the underlying symbol */ const Symbol & getSymbol ( ) const &; + /** + * Getter of the underlying symbol. + * + * \return the underlying symbol + */ Symbol && getSymbol ( ) &&; + /** + * Getter of the differentiating number. + * + * \return the differentiating number + */ const primitive::Integer & getId ( ) const &; + /** + * Getter of the differentiating number. + * + * \return the differentiating number + */ primitive::Integer && getId ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const UniqueSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/VariablesBarSymbol.h b/alib2data/src/alphabet/VariablesBarSymbol.h index 8e8cc58c1588f91c2ade3ed73bc6ae1f55c88594..f5afe99242b0f435891f229e2cbb4f2f53568358 100644 --- a/alib2data/src/alphabet/VariablesBarSymbol.h +++ b/alib2data/src/alphabet/VariablesBarSymbol.h @@ -1,6 +1,22 @@ /* * VariablesBarSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Apr 10, 2013 * Author: Jan Travnicek */ @@ -16,36 +32,70 @@ namespace alphabet { /** - * Represents bar symbol for tree linearization. + * \brief + * Represents variables bar symbol used in tree linearization. */ class VariablesBarSymbol : public SymbolBase { public: /** - * Creates a bar symbol. - * @param symbol name of the symbol + * \brief + * Creates a new instance of the symbol. */ explicit VariablesBarSymbol ( ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const VariablesBarSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < std::is_integral < Base >::value, Base >::type instance ( ); + + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < ! std::is_integral < Base >::value, Base >::type instance ( ); + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; }; diff --git a/alib2data/src/alphabet/WildcardSymbol.h b/alib2data/src/alphabet/WildcardSymbol.h index fd5f66ecdd4584eee873d7d54b109185d277b6bd..1e40d41edade68e787d6184f35325f3e222db91d 100644 --- a/alib2data/src/alphabet/WildcardSymbol.h +++ b/alib2data/src/alphabet/WildcardSymbol.h @@ -1,6 +1,22 @@ /* * WildcardSymbol.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Apr 10, 2013 * Author: Jan Travnicek */ @@ -16,36 +32,70 @@ namespace alphabet { /** - * Represents subtreeWildcard symbol for tree linearization. + * \brief + * Represents a wildcard used as representation of anything here in a string or a tree. */ class WildcardSymbol : public SymbolBase { public: /** - * Creates a subtreeWildcard symbol. - * @param symbol name of the symbol + * \brief + * Creates a new instance of the symbol. */ explicit WildcardSymbol ( ); + /** + * @copydoc alphabet::SymbolBase::clone ( ) const & + */ virtual SymbolBase * clone ( ) const &; + + /** + * @copydoc alphabet::SymbolBase::clone ( ) && + */ virtual SymbolBase * clone ( ) &&; + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same symbols + */ virtual int compare ( const WildcardSymbol & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & out ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < std::is_integral < Base >::value, Base >::type instance ( ); + + /** + * \brief Factory for the symbol construction of the symbol based on given type. + */ template < typename Base > static inline typename std::enable_if < ! std::is_integral < Base >::value, Base >::type instance ( ); + /** + * @copydoc object::ObjectBase::inc ( ) && + */ virtual SymbolBase * inc ( ) &&; };