/// <summary> /// Adds the specified item into graph structure /// </summary> /// <param name="__item">The item.</param> public virtual graphWrapNode <TItem> Add(TItem __item) { if (!mychildren.ContainsKey(__item.name)) { var tkng = new graphWrapNode <TItem>(__item, this); children.Add(__item.name, tkng); return(tkng); } return(this[__item.name] as graphWrapNode <TItem>); }
/// <summary> /// Adds new node or nodes to correspond to specified path or name. <c>pathOrName</c> can be path like: path1\\path2\\path3 /// </summary> /// <param name="pathWithName">Name of the path with.</param> /// <param name="__item">The item.</param> /// <returns></returns> public virtual graphWrapNode <TItem> Add(String pathWithName, TItem __item) { List <String> pathParts = pathWithName.SplitSmart(pathSeparator); graphWrapNode <TItem> head = this; foreach (String part in pathParts) { head = head.Add(part); } head.SetItem(__item); return(head); }
/// <summary> /// Takes data item instance from the wrapper /// </summary> /// <param name="wrapper">Object that holds the instance</param> /// <returns> /// item that was held by the instance /// </returns> protected override TItem GetInstanceToPack(graphWrapNode <TItem> wrapper) { return(wrapper.item); }
/// <summary> /// Utility method that returns Unique path to the specified node /// </summary> /// <param name="wrapper">Object that holds the instance</param> /// <returns> /// ID /// </returns> protected override string GetDataPackageID(graphWrapNode <TItem> wrapper) { return(wrapper.path); }
protected graphWrapNode(TItem __item, graphWrapNode <TItem> __parent = null) { _item = __item; parent = __parent; }
protected graphWrapNode(String __name, graphWrapNode <TItem> __parent = null) { name = __name; parent = __parent; }