Skip to content

Commit

Permalink
add repr for state and node
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph-Edwards committed Oct 2, 2024
1 parent be78f53 commit 60cb1e4
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions include/libsemigroups/ukkonen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2449,6 +2449,44 @@ namespace libsemigroups {
u.number_of_distinct_words());
}

//! \brief Return a human readable representation of an Ukkonen::State object.
//!
//! Return a human readable representation of an Ukkonen::State object.
//!
//! \param st the Ukkonen::State object.
//!
//! \returns A value of type std::string
//!
//! \exceptions
//! \no_libsemigroups_except
[[nodiscard]] inline std::string
to_human_readable_repr(Ukkonen::State const& st,
std::string const& sep = "::") {
return fmt::format(
"<Ukkonen{}State with pos = {} and v = {}>", sep, st.pos, st.v);
}

//! \brief Return a human readable representation of an Ukkonen::Node object.
//!
//! Return a human readable representation of an Ukkonen::Node object.
//!
//! \param node the Ukkonen::Node object.
//!
//! \returns A value of type std::string
//!
//! \exceptions
//! \no_libsemigroups_except
[[nodiscard]] inline std::string
to_human_readable_repr(Ukkonen::Node const& node,
std::string const& sep = "::") {
return fmt::format(
"<Ukkonen{}Node with {} children and parent edge label [{}, {})>",
sep,
node.children.size(),
node.l,
node.r);
}

//! @}

} // namespace libsemigroups
Expand Down

0 comments on commit 60cb1e4

Please sign in to comment.