19 #ifndef LIBSEMIGROUPS_SRC_RWSE_H_ 20 #define LIBSEMIGROUPS_SRC_RWSE_H_ 40 :
Element(Element::elm_t::RWSE), _rws(rws), _rws_word(w) {
59 LIBSEMIGROUPS_ASSERT(w !=
nullptr);
76 :
RWSE(&rws,
RWS::letter_to_rws_word(a)) {}
89 LIBSEMIGROUPS_ASSERT(_rws_word !=
nullptr);
90 LIBSEMIGROUPS_ASSERT(static_cast<RWSE const&>(that)._rws_word !=
nullptr);
91 return *(
static_cast<RWSE const&
>(that)._rws_word) == *(this->_rws_word);
160 LIBSEMIGROUPS_ASSERT(_rws_word !=
nullptr);
161 this->
_hash_value = std::hash<rws_word_t>()(*_rws_word);
189 #endif // LIBSEMIGROUPS_SRC_RWSE_H_ void cache_hash_value() const override
Calculates a hash value for this object which is cached.
Definition: rwse.h:159
static index_t const LIMIT_MAX
This variable is used to indicate the maximum possible limit that can be used with Semigroup::enumera...
Definition: semigroups.h:864
Element(elm_t type=Element::elm_t::NOT_RWSE)
A constructor.
Definition: elements.h:76
void rewrite(rws_word_t *w) const
Rewrites the word pointed to by w in-place according to the current rules in the rewriting system...
Definition: rws.cc:195
std::vector< letter_t > word_t
Type for a word over the generators of a semigroup.
Definition: semigroups.h:49
void really_delete() override
Deletes the underlying rws_word_t that this object wraps.
Definition: rwse.h:119
void swap(Element *x) override
Swap another Element with this.
Definition: rwse.cc:54
size_t _hash_value
This data member holds a cached version of the hash value of an Element. It is stored here if it is e...
Definition: elements.h:281
Abstract base class for semigroup elements.
Definition: elements.h:57
size_t degree() const override
Returns the degree of an RWSE.
Definition: rwse.h:142
bool operator<(const Element &that) const override
Returns true if this is less than that and false if it is not.
Definition: rwse.cc:25
Element * really_copy(size_t increase_deg_by) const override
Returns a pointer to a copy of this.
Definition: rwse.cc:38
rws_word_t const * get_rws_word() const
Returns a pointer to the rws_word_t used to create this.
Definition: rwse.h:178
void redefine(Element const *x, Element const *y) override
Multiply x and y and stores the result in this.
Definition: rwse.cc:62
std::string rws_word_t
Type for words for rewriting systems.
Definition: rws.h:37
Namespace for everything in the libsemigroups library.
Definition: blocks.cc:32
void copy(Element const *x) override
Copy x into this.
Definition: rwse.cc:46
size_t complexity() const override
Returns the approximate time complexity of multiplying two RWSE's.
Definition: rwse.h:132
RWSE(RWS *rws, rws_word_t *w)
Constructor from a rewriting system and a word.
Definition: rwse.h:58
Element * identity() const override
Return the identity RWSE.
Definition: rwse.h:152
This class is used to represent a string rewriting system defining a finitely presented monoid or sem...
Definition: rws.h:122
bool operator==(Element const &that) const override
Returns true if this equals that.
Definition: rwse.h:88
size_t letter_t
Type for the index of a generator of a semigroup.
Definition: semigroups.h:46
Subclass of Element that wraps an libsemigroups::rws_word_t.
Definition: rwse.h:37
RWSE(RWS &rws, letter_t const &a)
Constructor from a rewriting system and a letter.
Definition: rwse.h:75
RWSE(RWS &rws, rws_word_t const &w)
Constructor from a rewriting system and a word.
Definition: rwse.h:70
RWSE(RWS &rws, word_t const &w)
Constructor from a rewriting system and a word.
Definition: rwse.h:81