![]() |
Cadabra
Computer algebra system for field theory problems
|
ExNode is a combination of an Ex::iterator and an interface which we can use to manipulate the data pointed to by this iterator.
In this way, we can use
for it in ex: ...
loops and still use 'it' to do things like insertion etc. which requires knowing the Ex::iterator.
Iterators are much safer than in C++, because they carry the tree modification interface themselves, and can thus compute their next value for any destructive operation.
Public Member Functions | |
ExNode (Ex &) | |
ExNode & | iter () |
ExNode & | next () |
std::string | get_name () const |
void | set_name (std::string) |
void | replace (Ex &rep) |
Take a child argument out of the node and add as child of current. More... | |
void | insert (Ex &ins) |
Insert a subtree as previous sibling of the current node. More... | |
void | insert_it (ExNode ins) |
void | append_child (Ex &) |
Append a subtree as a child. More... | |
void | append_child_it (ExNode ins) |
void | erase () |
Erase the current node, iterator becomes invalid! More... | |
ExNode | getitem_string (std::string tag) |
Get a new iterator which always stays below the current one. More... | |
ExNode | indices () |
Get a new iterator which only iterates over all first-level indices. More... | |
ExNode | args () |
Get a new iterator which only iterates over all first-level arguments (non-indices). More... | |
ExNode | children () |
Get a new iterator which iterates over all first-level children (a sibling iterator, in other words). More... | |
void | update (bool first) |
Public Attributes | |
Ex & | ex |
Ex::iterator | it |
std::string | tag |
bool | indices_only |
bool | args_only |
Ex::iterator | nxtit |
Ex::sibling_iterator | sibnxtit |
bool | use_sibling_iterator |
Ex::iterator | topit |
Ex::iterator | stopit |
ExNode::ExNode | ( | Ex & | ex_ | ) |
void ExNode::append_child | ( | Ex & | rep | ) |
Append a subtree as a child.
void ExNode::append_child_it | ( | ExNode | ins | ) |
ExNode ExNode::args | ( | ) |
Get a new iterator which only iterates over all first-level arguments (non-indices).
ExNode ExNode::children | ( | ) |
Get a new iterator which iterates over all first-level children (a sibling iterator, in other words).
void ExNode::erase | ( | ) |
Erase the current node, iterator becomes invalid!
std::string ExNode::get_name | ( | ) | const |
ExNode ExNode::getitem_string | ( | std::string | tag | ) |
Get a new iterator which always stays below the current one.
ExNode ExNode::indices | ( | ) |
Get a new iterator which only iterates over all first-level indices.
void ExNode::insert | ( | Ex & | ins | ) |
Insert a subtree as previous sibling of the current node.
void ExNode::insert_it | ( | ExNode | ins | ) |
ExNode & ExNode::iter | ( | ) |
ExNode & ExNode::next | ( | ) |
void ExNode::replace | ( | Ex & | rep | ) |
Take a child argument out of the node and add as child of current.
Replace the subtree at the current node with the given expression. Updates the iterator so that it points to the replacement subtree.
void ExNode::set_name | ( | std::string | nm | ) |
void ExNode::update | ( | bool | first | ) |
bool ExNode::args_only |
Ex& ExNode::ex |
bool ExNode::indices_only |
Ex::iterator ExNode::it |
Ex::iterator ExNode::nxtit |
Ex::sibling_iterator ExNode::sibnxtit |
Ex::iterator ExNode::stopit |
std::string ExNode::tag |
Ex::iterator ExNode::topit |
bool ExNode::use_sibling_iterator |