Exemple #1
0
 public HashSet <int> GetParentsBelow(int id)
 {
     BackendData.Foo foo = BackendData.FindItemRecursive(this.root, id);
     if (foo == null)
     {
         return(new HashSet <int>());
     }
     if (this.m_RecursiveFindParentsBelow)
     {
         return(this.GetParentsBelowRecursive(foo));
     }
     return(this.GetParentsBelowStackBased(foo));
 }
        protected override HashSet <int> GetParentsAbove(int id)
        {
            HashSet <int> hashSet = new HashSet <int>();

            for (BackendData.Foo foo = BackendData.FindItemRecursive(this.m_Backend.root, id); foo != null; foo = foo.parent)
            {
                if (foo.parent != null)
                {
                    hashSet.Add(foo.parent.id);
                }
            }
            return(hashSet);
        }
Exemple #3
0
 public static BackendData.Foo FindItemRecursive(BackendData.Foo item, int id)
 {
     if (item == null)
     {
         return(null);
     }
     if (item.id == id)
     {
         return(item);
     }
     if (item.children == null)
     {
         return(null);
     }
     foreach (BackendData.Foo current in item.children)
     {
         BackendData.Foo foo = BackendData.FindItemRecursive(current, id);
         if (foo != null)
         {
             return(foo);
         }
     }
     return(null);
 }