public static TreeDoc CreateListRange(string name, IEnumerable children) { TreeDoc doc = new TreeDoc(name); doc.AddRange(children); return(doc); }
public static TreeDoc ObjectToTreeDoc(object item) { if (item == null) { return(TreeDoc.CreateNull()); } if (item is TreeDoc) { return((TreeDoc)item); } if (item is String) { return(TreeDoc.CreateLeaf((String)item)); } Func <TreeDoc> converter = (Func <TreeDoc>)Delegate.CreateDelegate(typeof(Func <TreeDoc>), item, "ToTreeDoc", false, false); if (converter != null) { return(converter()); } return(TreeDoc.CreateLeaf(ObjectToString(item))); }
public void Insert(int index, TreeDoc item) { int count; if (mChildren != null) { count = mChildren.Count; } else { count = 0; } if ((uint)index > count) { throw new ArgumentOutOfRangeException(); } if (item.Parent != null) { throw new InvalidOperationException("item has a parent already"); } InternalRequireList(); mChildren.Insert(index, item); item.Parent = this; }
private static IEnumerable<TreeDoc> FindAncestorsAndSelf(TreeDoc doc) { while (doc != null) { yield return doc; doc = doc.Parent; } }
public void RemoveAt(int index, TreeDoc item) { mChildren.RemoveAt(index); InternalDestroyListIfEmpty(); }
public bool IsBefore(TreeDoc other) { throw new NotImplementedException(); }
public bool IsAfter(TreeDoc other) { throw new NotImplementedException(); }
public void Insert(int index, TreeDoc item) { int count; if (mChildren != null) count = mChildren.Count; else count = 0; if ((uint)index > count) throw new ArgumentOutOfRangeException(); if (item.Parent != null) throw new InvalidOperationException("item has a parent already"); InternalRequireList(); mChildren.Insert(index, item); item.Parent = this; }
public static TreeDoc CreateListRange(IEnumerable children) { TreeDoc doc = new TreeDoc(""); doc.AddRange(children); return doc; }
public static TreeDoc CreateListRange(string name, IEnumerable children) { TreeDoc doc = new TreeDoc(name); doc.AddRange(children); return doc; }
public static TreeDoc CreateLeaf(string name, string value) { TreeDoc doc = new TreeDoc(name); doc.Value = value; return doc; }