Include file:
#include "mcrl2/atermpp/algorithm.h"
Algorithms for ATerms.
atermpp::detail::bottom_up_replace_aterm_builder
atermpp::detail::cached_bottom_up_replace_aterm_builder
atermpp::detail::partial_replace_aterm_builder
atermpp::detail::replace_aterm_builder
atermpp::
bottom_up_replace
(Term t, const aterm_appl &old_value, const aterm_appl &new_value)¶Replaces each subterm in t that is equal to old_value with new_value. The replacements are performed in top down order. For example, replace(f(f(x)), f(x), x) returns f(x) and not x.
Parameters:
Returns: The result of the replacement.
atermpp::
bottom_up_replace
(Term t, ReplaceFunction r)¶Replaces each subterm x of t by r(x). The ReplaceFunction r has the following signature: aterm_appl x; aterm_appl result = r(x); The replacements are performed in bottom up order. For example, replace(f(f(x)), f(x), x) returns x.
Parameters:
Returns: The result of the replacement.
atermpp::
bottom_up_replace
(Term t, ReplaceFunction r, std::unordered_map<aterm_appl, aterm> &cache)¶Replaces each subterm x of t by r(x). The ReplaceFunction r has the following signature: aterm_appl x; aterm_appl result = r(x); The replacements are performed in bottom up order. For example, replace(f(f(x)), f(x), x) returns x.
Parameters:
Returns: The result of the replacement.
atermpp::
find_all_if
(const Term &t, MatchPredicate match, OutputIterator destBegin)¶Finds all subterms of t that match a given predicate, and writes the found terms to the destination range starting with destBegin.
Parameters:
atermpp::
find_if
(const Term &t, MatchPredicate match)¶Finds a subterm of t that matches a given predicate.
Parameters:
Returns: A subterm that matches the given predicate, or aterm_appl() if none was found.
atermpp::
for_each
(Term t, UnaryFunction op)¶Calls op(elem) for subterms of the term t.
Parameters:
Returns: a copy of the (internally modified) op. The function op must have the signature bool op(aterm_appl t). When op(t) is false, the children of t are skipped.
atermpp::
partial_find_all_if
(Term t, MatchPredicate match, StopPredicate stop, OutputIterator destBegin)¶Finds all subterms of t that match a given predicate, and writes the found terms to the destination range starting with destBegin. The term is only partially traversed. If the stop predicate returns true in a subterm, the recursion is not continued.
Parameters:
atermpp::
partial_find_if
(Term t, MatchPredicate match, StopPredicate stop)¶Finds a subterm of t that matches a given predicate. The term is only partially traversed. If the stop predicate returns true in a subterm, the recursion is not continued.
Parameters:
Returns: A subterm that matches the given predicate, or aterm_appl() if none was found.
atermpp::
partial_replace
(Term t, ReplaceFunction r)¶Replaces subterms x of t by r(x). The replace function r returns an additional boolean value. This value is used to prevent further recursion. The ReplaceFunction r has the following signature: aterm_appl x; std::pair<aterm_appl, bool> result = r(x); result.first is the result r(x) of the replacement result.second denotes if the recursion should be continued The replacements are performed in top down order.
Parameters:
Returns: The result of the replacement.
atermpp::
replace
(const Term &t, const aterm &old_value, const aterm &new_value)¶Replaces each subterm in t that is equal to old_value with new_value. The replacements are performed in top down order. For example, replace(f(f(x)), f(x), x) returns f(x) and not x.
Parameters:
Returns: The result of the replacement.
atermpp::
replace
(const Term &t, ReplaceFunction r)¶Replaces each subterm x of t by r(x). The ReplaceFunction r has the following signature: aterm_appl x; aterm_appl result = r(x); The replacements are performed in top down order.
Parameters:
Returns: The result of the replacement.
atermpp::detail::
make_bottom_up_replace_aterm_builder
(ReplaceFunction f)¶atermpp::detail::
make_cached_bottom_up_replace_aterm_builder
(ReplaceFunction f, std::unordered_map<aterm_appl, aterm> &cache)¶atermpp::detail::
make_partial_replace_aterm_builder
(ReplaceFunction f)¶atermpp::detail::
make_replace_aterm_builder
(ReplaceFunction f)¶