From 9725af232f8be475087b6c64d16274bc6a1c0d32 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Thu, 14 Jun 2018 08:25:09 +0200 Subject: [PATCH] add documentation of symbols --- alib2data/src/alphabet/BarSymbol.h | 56 ++++++++++++- alib2data/src/alphabet/BlankSymbol.h | 56 ++++++++++++- .../src/alphabet/BottomOfTheStackSymbol.h | 56 ++++++++++++- alib2data/src/alphabet/EndSymbol.h | 56 ++++++++++++- alib2data/src/alphabet/InitialSymbol.h | 55 ++++++++++++- alib2data/src/alphabet/LabeledSymbol.h | 78 ++++++++++++++++-- .../src/alphabet/NonlinearVariableSymbol.h | 60 +++++++++++++- alib2data/src/alphabet/RankedSymbol.h | 79 +++++++++++++++++- alib2data/src/alphabet/StartSymbol.h | 56 ++++++++++++- alib2data/src/alphabet/UniqueSymbol.h | 82 +++++++++++++++++-- alib2data/src/alphabet/VariablesBarSymbol.h | 56 ++++++++++++- alib2data/src/alphabet/WildcardSymbol.h | 56 ++++++++++++- 12 files changed, 708 insertions(+), 38 deletions(-) diff --git a/alib2data/src/alphabet/BarSymbol.h b/alib2data/src/alphabet/BarSymbol.h index 1c76552091..ed84a2e9d2 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 8872d0ceb0..1eb01b89e0 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 17f79e95d5..6fd23d7387 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 88ec81d296..fa623e62a1 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 1e4bf6665e..8e2749d791 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 e4f9593545..a5716d19f1 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 e454590ab4..94b91aae67 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 59eddd8af3..74001c2cd2 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 8b8546f313..5ea4b4d88a 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 50a9a00b2b..174566a146 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 8e8cc58c15..f5afe99242 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 fd5f66ecdd..1e40d41eda 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 ( ) &&; }; -- GitLab