public void Add(IBaseObjects key, IBaseObjects child = null) { var childKey = KeyFor(key); if (childKey == null) { childKey = new SimpleContainObjects(); childKey.Key = key; this.Add(childKey); } if (child != null) { //childKey.Children.Add(child); childKey.Childs.Add(child); } }
public SimpleContainObjects RecursiveKeyFor(IBaseObjects key) { var data = KeyFor(key); if (data != null) { return(data); } var items = this.Select(it => it.Childs).ToArray(); foreach (var item in items) { data = item.RecursiveKeyFor(key); if (data != null) { return(data); } } return(null); }
public SimpleJobConditionalTransformers Add(IBaseObjects transformParentNode, IBaseObjects senderORTransform = null) { //if (!association.ContainsKey(transformParentNode)) //{ // association.Add(transformParentNode); //} var val = association.RecursiveKeyFor(transformParentNode); if (val == null) { association.Add(transformParentNode); val = association.RecursiveKeyFor(transformParentNode); } if (senderORTransform != null) { //val.Children.Add(senderORTransform); val.Childs.Add(senderORTransform); } return(this); }
public bool ContainsKey(IBaseObjects key) { return(KeyFor(key) != null); }
public SimpleContainObjects KeyFor(IBaseObjects key) { return(this.FirstOrDefault(it => it.Key == key)); }