/// <summary> /// Add achild element to the current tupleset /// </summary> /// <param name="child"></param> /// <param name="parentId"></param> /// <param name="taxonomies"></param> public void Add(ITupleSetChild child, string parentId, Taxonomy[] taxonomies) { Element ele = null; foreach (Taxonomy tax in taxonomies) { ele = tax.AllElements[parentId] as Element; if (ele != null) { break; } } if (ele != null) { double order = ele.GetTupleChildOrder(child.GetId()); if (order >= 0) { while (Children.ContainsKey((float)order)) { order = order + 0.005; } this.Children.Add((float)order, child); return; } } this.AddChild(child); }
/// <summary> /// Adds a child to the list in sequence.. /// </summary> /// <param name="child"></param> public void AddChild(ITupleSetChild child) { float order = 1; // not found, add it to the end order *= (this.Children.Count + 1); Children.Add(order, child); if (child is TupleSet) { (child as TupleSet).ParentSet = this; } }
/// <summary> /// check if it contains the node... /// </summary> /// <param name="node"></param> public bool ContainsNode(ITupleSetChild node) { return(Children.IndexOfValue(node) >= 0 ? true : false); }