/*
Copyright 2007-2013 The NGenerics Team
(https://github.com/ngenerics/ngenerics/wiki/Team)
This program is licensed under the GNU Lesser General Public License (LGPL). You should
have received a copy of the license along with the source code. If not, an online copy
of the license can be found at http://www.gnu.org/copyleft/lesser.html.
*/
using System;
namespace NGenerics.DataStructures.Trees {
///
/// An interface for the tree data structure
///
/// The type of elements in the tree.
public interface ITree {
///
/// Adds the specified child to the tree.
///
/// The child to add..
void Add(ITree child);
///
/// Gets the data held in this node.
///
/// The data.
T Data { get; }
///
/// Gets the degree of this node.
///
/// The degree of this node.
int Degree { get; }
///
/// Gets the child at the specified index.
///
/// The index.
/// The child at the specified index.
ITree GetChild(int index);
///
/// Gets the height of this tree.
///
/// The height of this tree.
int Height { get; }
///
/// Gets a value indicating whether this instance is leaf node.
///
///
/// true if this instance is leaf node; otherwise, false.
///
bool IsLeafNode { get; }
///
/// Removes the specified child.
///
/// The child.
/// An indication of whether the child was found (and removed) from this tree.
bool Remove(ITree child);
///
/// Finds the node for which the given predicate holds true.
///
/// The condition to test on the data item.
/// The fist node that matches the condition if found, otherwise null.
ITree FindNode(Predicate condition);
///
/// Gets the parent of the current node.
///
/// The parent of the current node.
ITree Parent { get;}
}
}