Mercury library 1.0 Translation of CFG grammars into an object model (Bachelor's thesis).

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
Public Member Functions | Properties | List of all members
Mercury.Nucleus.Trees.Tree< T > Class Template Reference

A non-balanced tree implementation that can be referenced from many other trees. Because of that, there is no way to get back to the parent node. More...

Inheritance diagram for Mercury.Nucleus.Trees.Tree< T >:

## Public Member Functions
| Tree (T value)
| Initializes a new instance of the Tree{T} class with no child nodes (Leaf) More...
| Tree (Tree< T > other, IEnumerable< Tree< T >> children)
| "Copy" constructor More...
| Tree (T value, IEnumerable< Tree< T >> children)
| Initializes a new instance of the Tree{T} class with the given parent and children More...
override bool | Equals (object obj)
override int | GetHashCode ()
string | ToString (int maxdepth)
override string | ToString ()
bool | Equals (Tree< T > other)
int | CompareTo (Tree< T > other)
IEnumerator< T > | GetEnumerator ()

## Properties
int | Depth`[get, set]`
| Maximum depth of the tree More...
int | LeavesCount`[get, set]`
| Number of leaves in the tree More...
int | NodesCount`[get, set]`
| Number of nodes in the tree More...
T | Value`[get, set]`
| The value of this node More...
bool | IsLeaf`[get]`
| Checks whether this node has no children More...
IReadOnlyList< Tree< T > > | Children`[get, set]`
| Tree's children More...
DFSTreeEnumerator< T > | DepthFirstEnumerator`[get]`
| Depth-First enumerator (stack based) More...
BFSTreeEnumerator< T > | BreadthFirstEnumerator`[get]`
| Breadth-First Enumerator (queue based) More...
Tree< T > | this[int ix]`[get]`
| Indexer returns the child More...

## Detailed Description

A non-balanced tree implementation that can be referenced from many other trees. Because of that, there is no way to get back to the parent node.

Example:

            A      |    D
           / \     |   / \
          B   C    |  B   B
             / \   |
            B   B  |

All "B" subtrees here may be the same instance of the Tree{T} class.

Template Parameters

  T | The type of node values

Definition at line 30 of file Tree.cs.

## Constructor & Destructor Documentation

Mercury.Nucleus.Trees.Tree< T >.Tree | ( | T | value | ) |

Initializes a new instance of the Tree{T} class with no child nodes (Leaf)

Parameters

  value | The value of the node

Definition at line 49 of file Tree.cs.

Mercury.Nucleus.Trees.Tree< T >.Tree | ( | Tree< T > | other,
|  | IEnumerable< Tree< T >> | children
| ) |  |

"Copy" constructor

Parameters

  other | Source tree
  children | Additional children

Definition at line 56 of file Tree.cs.

Mercury.Nucleus.Trees.Tree< T >.Tree | ( | T | value,
|  | IEnumerable< Tree< T >> | children
| ) |  |

Initializes a new instance of the Tree{T} class with the given parent and children

Parameters

  value | The value of the node
  children | The children to be added

Definition at line 66 of file Tree.cs.

## Member Function Documentation

int Mercury.Nucleus.Trees.Tree< T >.CompareTo | ( | Tree< T > | other | ) |

Definition at line 197 of file Tree.cs.

override bool Mercury.Nucleus.Trees.Tree< T >.Equals | ( | object | obj | ) |

Definition at line 125 of file Tree.cs.

bool Mercury.Nucleus.Trees.Tree< T >.Equals | ( | Tree< T > | other | ) |

Definition at line 178 of file Tree.cs.

IEnumerator<T> Mercury.Nucleus.Trees.Tree< T >.GetEnumerator | ( |  | ) |

Definition at line 213 of file Tree.cs.

override int Mercury.Nucleus.Trees.Tree< T >.GetHashCode | ( |  | ) |

Definition at line 131 of file Tree.cs.

string Mercury.Nucleus.Trees.Tree< T >.ToString | ( | int | maxdepth | ) |

Definition at line 148 of file Tree.cs.

override string Mercury.Nucleus.Trees.Tree< T >.ToString | ( |  | ) |

Definition at line 169 of file Tree.cs.

## Property Documentation

BFSTreeEnumerator<T> Mercury.Nucleus.Trees.Tree< T >.BreadthFirstEnumerator
| get

Breadth-First Enumerator (queue based)

Definition at line 112 of file Tree.cs.

IReadOnlyList<Tree<T> > Mercury.Nucleus.Trees.Tree< T >.Children
| get set

Tree's children

Gets the children list as read-only

Definition at line 104 of file Tree.cs.

int Mercury.Nucleus.Trees.Tree< T >.Depth
| get set

Maximum depth of the tree

Definition at line 88 of file Tree.cs.

DFSTreeEnumerator<T> Mercury.Nucleus.Trees.Tree< T >.DepthFirstEnumerator
| get

Depth-First enumerator (stack based)

Definition at line 108 of file Tree.cs.

bool Mercury.Nucleus.Trees.Tree< T >.IsLeaf
| get

Checks whether this node has no children

Definition at line 100 of file Tree.cs.

int Mercury.Nucleus.Trees.Tree< T >.LeavesCount
| get set

Number of leaves in the tree

Definition at line 91 of file Tree.cs.

int Mercury.Nucleus.Trees.Tree< T >.NodesCount
| get set

Number of nodes in the tree

Definition at line 94 of file Tree.cs.

Tree<T> Mercury.Nucleus.Trees.Tree< T >.this[int ix]
| get

Indexer returns the child

Parameters

  ix |

Returns

Definition at line 119 of file Tree.cs.

T Mercury.Nucleus.Trees.Tree< T >.Value
| get set

The value of this node

Definition at line 97 of file Tree.cs.

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

- Mercury/Mercury/Nucleus/Trees/Tree.cs