Cadabra
Computer algebra system for field theory problems
Public Member Functions | Public Attributes | List of all members
ExNode Class Reference

Description

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 &)
 
ExNodeiter ()
 
ExNodenext ()
 
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

Exex
 
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
 

Constructor & Destructor Documentation

◆ ExNode()

ExNode::ExNode ( Ex ex_)

Member Function Documentation

◆ append_child()

void ExNode::append_child ( Ex rep)

Append a subtree as a child.

◆ append_child_it()

void ExNode::append_child_it ( ExNode  ins)

◆ args()

ExNode ExNode::args ( )

Get a new iterator which only iterates over all first-level arguments (non-indices).

◆ children()

ExNode ExNode::children ( )

Get a new iterator which iterates over all first-level children (a sibling iterator, in other words).

◆ erase()

void ExNode::erase ( )

Erase the current node, iterator becomes invalid!

◆ get_name()

std::string ExNode::get_name ( ) const

◆ getitem_string()

ExNode ExNode::getitem_string ( std::string  tag)

Get a new iterator which always stays below the current one.

◆ indices()

ExNode ExNode::indices ( )

Get a new iterator which only iterates over all first-level indices.

◆ insert()

void ExNode::insert ( Ex ins)

Insert a subtree as previous sibling of the current node.

◆ insert_it()

void ExNode::insert_it ( ExNode  ins)

◆ iter()

ExNode & ExNode::iter ( )

◆ next()

ExNode & ExNode::next ( )

◆ replace()

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.

◆ set_name()

void ExNode::set_name ( std::string  nm)

◆ update()

void ExNode::update ( bool  first)

Member Data Documentation

◆ args_only

bool ExNode::args_only

◆ ex

Ex& ExNode::ex

◆ indices_only

bool ExNode::indices_only

◆ it

Ex::iterator ExNode::it

◆ nxtit

Ex::iterator ExNode::nxtit

◆ sibnxtit

Ex::sibling_iterator ExNode::sibnxtit

◆ stopit

Ex::iterator ExNode::stopit

◆ tag

std::string ExNode::tag

◆ topit

Ex::iterator ExNode::topit

◆ use_sibling_iterator

bool ExNode::use_sibling_iterator

The documentation for this class was generated from the following file: