Copyright © (C) 2015, Pablo Lamela, Simon Thompson
Authors: Pablo Lamela Seijas (P.Lamela-Seijas@kent.ac.uk), Simon Thompson (S.J.Thompson@kent.ac.uk).
abstract datatype: tree()
abstract datatype: tree_node()
abstract datatype: tree_ph()
| breadth_fold/3 | Folds a function through a tree in breadth first order. |
| collapse_node/2 | Removes the node from the tree, and attaches its children to its parent in the place it was. |
| copy_properties/2 | Copies the properties stored in the nodes of OriTree into the nodes of DestTree. |
| create_node_pair/2 | Joins two nodes into a single node (node pair). |
| dict_get/3 |
Like dict:fetch/2 but allows to specify a default value. |
| get_child_ph/1 | Generates a placeholder for a child of the node. |
| get_children/2 | Returns the children of Node in the Tree. |
| get_data/1 | Returns the extra information stored on the tree. |
| get_node/2 | Finds a node by using its placeholder. |
| get_pair_tuple/1 | Splits a node pair into the original two nodes. |
| get_parent/2 | Returns the parent of Node in the Tree. |
| get_ph/1 | Returns the placeholder for a node or node pair Node. |
| get_pos_in_parent/2 | Finds the position of Node in the list of children of Parent. |
| get_property/2 | Extracts the value of a property from a tree_node. |
| get_root_node/1 | Returns the root node of the Tree. |
| get_value/1 | Extracts the value from a tree_node. |
| group_children/5 | Moves the children with PH ChildrenPHs to a new node, and puts the new node in the place of the children, it returns both the new node and the updated tree. |
| index_by/2 | Returns a map with the nodes of the Tree as values and the result of applying Fun to them as keys. |
| is_node_pair/1 | Returns whether a node is a node pair. |
| new/0 | Creates a empty tree. |
| new_node_ph/1 | Creates a node from a placeholder. |
| replace_with_elements/3 | Replaces the first occurrence of Pattern in List with the elements in the list Replacement. |
| set_data/2 | Sets the extra information stored on the tree. |
| set_property/3 | Sets the value property for a tree_node. |
| set_value/2 | Sets the value for a tree_node. |
| store_node/2 | Adds a new node to the tree, or updates an existing one. |
| upgrade_node/2 | Moves a node upwards a level. |
breadth_fold(Fun::FFun, AccIn::Acc, Tree::tree()) -> AccOut::Acc
Folds a function through a tree in breadth first order.
collapse_node(Tree_node, Tree) -> any()
Removes the node from the tree, and attaches its children to its parent in the place it was. It expects the value of the parent to be updated appropriately.
copy_properties(OriTree::tree:tree(), DestTree::tree:tree()) -> tree:tree()
Copies the properties stored in the nodes of OriTree into the nodes of DestTree. Both trees must have the same exact topology.
create_node_pair(Node1::tree:tree_node(), Node2::tree:tree_node()) -> tree:tree_node()
Joins two nodes into a single node (node pair)
dict_get(Key::KeyType, Dict::dict:dict(KeyType, ValueType), DefaultValue::ValueType) -> ValueType
Like dict:fetch/2 but allows to specify a default value.
get_child_ph(Tree_node::tree_node()) -> {tree_node(), tree_ph()}
Generates a placeholder for a child of the node. A child generated
with the placeholder will be linked automatically to the node.
For the link to be created, the version of the node updated by
this function must be stored in the tree afterwards,
store_node/2, as well as the child generated with the
placeholder.
get_children(Node::tree:tree_node(), Tree::tree()) -> [tree:tree_node()]
Returns the children of Node in the Tree.
get_data(Tree::tree:tree()) -> Data::any()
Returns the extra information stored on the tree.
This can be any term and is stored with set_data/2.
get_node(PH::tree_ph(), Tree::tree()) -> error | {ok, tree_node()}
Finds a node by using its placeholder. It returns error if it
cannot be found.
get_pair_tuple(NodePair::tree:tree_node()) -> {tree:tree_node(), tree:tree_node()}
Splits a node pair into the original two nodes
get_parent(Node::tree:tree_node(), Tree::tree()) -> error | {ok, tree:tree_node()}
Returns the parent of Node in the Tree.
get_ph(Node::tree:tree_node()) -> {node, tree:tree_ph()} | {node_pair, tree:tree_ph(), tree:tree_ph()}
Returns the placeholder for a node or node pair Node. That is, an unique identifier for the Node, that is used as placeholder in the original position of the node in its parent. If Node is a node pair, two placeholders are returned.
get_pos_in_parent(Node::tree:tree_node(), Parent::tree:tree_node()) -> error | pos_integer()
Finds the position of Node in the list of children of Parent.
get_property(Key::term(), Node::tree_node()) -> {ok, Value::term()} | error
Extracts the value of a property from a tree_node. Returns error if it is not set.
get_root_node(Tree::tree()) -> tree:tree_node()
Returns the root node of the Tree.
get_value(Tree_node::tree_node()) -> term()
Extracts the value from a tree_node.
group_children(Tree_node::tree_node(), ChildrenPHs::[tree_ph()], NewParentValueGen::fun((PH::tree_node()) -> Value), Value, Tree::tree()) -> {tree_node(), tree:tree()}
Moves the children with PH ChildrenPHs to a new node, and puts the new node in the place of the children, it returns both the new node and the updated tree. A value, both for the parent and the new node which reflect the changes, is required. All nodes are assumed to NOT be node pairs, (before and after).
index_by(Fun::fun((Node) -> Idx), Tree::tree()) -> dict:dict(Idx, Node)
Returns a map with the nodes of the Tree as values and the result of applying Fun to them as keys.
is_node_pair(Node::tree:tree_node()) -> boolean()
Returns whether a node is a node pair
new() -> tree()
Creates a empty tree
new_node_ph(PH::tree_ph()) -> tree_node()
Creates a node from a placeholder. See get_child_ph/1.
replace_with_elements(Pattern::[El], List::[El], Replacement::[El]) -> [El]
Replaces the first occurrence of Pattern in List with the elements in the list Replacement. It assumes there no partial matches.
set_data(Data::any(), Tree::tree:tree()) -> NewTree::tree:tree()
Sets the extra information stored on the tree.
This can be any term and is retrieved from the tree with
get_data/1.
set_property(Key::term(), Value::term(), Node::tree_node()) -> tree_node()
Sets the value property for a tree_node. It does not update the tree,
obviously. For updating the tree the node must be stored
afterwards, store_node/2.
set_value(Value::term(), Node::tree_node()) -> tree_node()
Sets the value for a tree_node. It does not update the tree,
obviously. For updating the tree the node must be stored
afterwards, store_node/2.
store_node(Node::tree:tree_node(), Tree::tree()) -> tree()
Adds a new node to the tree, or updates an existing one.
upgrade_node(Tree_node, Tree) -> any()
Moves a node upwards a level. It expects the value of the two ancestors to be updated appropriately.
Generated by EDoc, Nov 5 2015, 16:30:18.