using System.Linq;
using Chernobyl.Values;
namespace Chernobyl.Collections.Generic.Graph
{
///
/// An interface for a type that is single vertex in a larger network with
/// each vertex holding data.
///
/// The type of the data contained by this.
public interface IDataNode : INode
{
///
/// The data held by this vertex.
///
IValue Data { get; }
}
///
/// Utility and extension methods for .
///
public static class DataNodeExtensions
{
///
/// Returns a holding the data on
/// the provided.
///
/// The instance whose data is to be retrieved.
/// The data of the node.
public static IDynamicContainer GetDynamicContainer(this INode node)
{
IDataNode dataNode = node.Connections.OfType>().First();
return (IDynamicContainer) dataNode.Data;
}
}
}