Ejemplo n.º 1
0
 private static void _MakeParentChain(ref Dictionary <string, TypeDescription> descriptions, TypeDescription node, ref List <int> ids)
 {
     foreach (var item in node.ParentIds)
     {
         // TODO 許して
         var parent = descriptions.Values.Where(m => m.Id == item).FirstOrDefault();
         if (parent == null)
         {
             continue;
         }
         ids.Add(item);
         _MakeParentChain(ref descriptions, parent, ref ids);
     }
 }
Ejemplo n.º 2
0
        private static void MakeParentChain(ref Dictionary <string, TypeDescription> descriptions, TypeDescription node)
        {
            // TODO 全階層を毎回新規で検索するのでキャッシュすれば良さげ
            var parentChain = new List <int>();

            _MakeParentChain(ref descriptions, node, ref parentChain);

            node.ParentChain = parentChain
                               // 多重継承時に同じ親IDを持つ可能性があるので重複排除
                               .Distinct()
                               // 昇順で二分探索可能にしておく
                               .OrderBy(m => m).ToList();
        }