19 #ifndef LIBSEMIGROUPS_SRC_RWSE_H_ 20 #define LIBSEMIGROUPS_SRC_RWSE_H_ 38 using rws_word_t = RWS::rws_word_t;
41 RWSE(
RWS* rws, rws_word_t* w,
bool reduce)
42 :
Element(Element::elm_t::RWSE), _rws(rws), _rws_word(w) {
61 LIBSEMIGROUPS_ASSERT(w !=
nullptr);
72 RWSE(
RWS& rws, rws_word_t
const& w) :
RWSE(&rws, new rws_word_t(w)) {}
90 LIBSEMIGROUPS_ASSERT(_rws_word !=
nullptr);
91 LIBSEMIGROUPS_ASSERT(static_cast<RWSE const&>(that)._rws_word !=
nullptr);
92 return *(
static_cast<RWSE const&
>(that)._rws_word) == *(this->_rws_word);
154 return new RWSE(_rws,
new rws_word_t());
161 LIBSEMIGROUPS_ASSERT(_rws_word !=
nullptr);
162 this->_hash_value = std::hash<rws_word_t>()(*_rws_word);
186 rws_word_t* _rws_word;
190 #endif // LIBSEMIGROUPS_SRC_RWSE_H_ std::string * rewrite(std::string *w) const
Rewrites the word w in-place according to the current rules in the rewriting system.
Definition: rws.h:271
void cache_hash_value() const override
Calculates a hash value for this object which is cached.
Definition: rwse.h:160
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:870
Element(elm_t type=Element::elm_t::NOT_RWSE)
A constructor.
Definition: elements.h:63
std::vector< letter_t > word_t
Type for a word over the generators of a semigroup.
Definition: semigroups.h:55
void really_delete() override
Deletes the underlying rws_word_t that this object wraps.
Definition: rwse.h:120
void swap(Element *x) override
Swap another Element with this.
Definition: rwse.cc:54
Abstract base class for semigroup elements.
Definition: elements.h:44
size_t degree() const override
Returns the degree of an RWSE.
Definition: rwse.h:143
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:179
void redefine(Element const *x, Element const *y) override
Multiply x and y and stores the result in this.
Definition: rwse.cc:62
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:133
RWSE(RWS *rws, rws_word_t *w)
Constructor from a rewriting system and a word.
Definition: rwse.h:60
Element * identity() const override
Return the identity RWSE.
Definition: rwse.h:153
This class is used to represent a string rewriting system defining a finitely presented monoid or sem...
Definition: rws.h:135
bool operator==(Element const &that) const override
Returns true if this equals that.
Definition: rwse.h:89
size_t letter_t
Type for the index of a generator of a semigroup.
Definition: semigroups.h:52
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:77
RWSE(RWS &rws, rws_word_t const &w)
Constructor from a rewriting system and a word.
Definition: rwse.h:72
RWSE(RWS &rws, word_t const &w)
Constructor from a rewriting system and a word.
Definition: rwse.h:82