public List <TypificationComponent> AssembleComponent()
        {
            var trunk = typifications.Where(typification => typification.ParentId == 0);

            foreach (Typification typification in trunk)
            {
                bool isComposite = typifications.Where(t => t.ParentId == typification.Id)
                                   .ToList()
                                   .Count() > 0;

                TypificationComponent component = factoryComponent(typification, isComposite);

                if (component.IsComposite())
                {
                    var c = Mount(component);
                    components.Add(c);
                }
                else
                {
                    components.Add(component);
                }
            }

            return(components);
        }
        public TypificationComponent Mount(TypificationComponent component)
        {
            var branch = typifications.Where(t => t.ParentId == component.Id);

            foreach (Typification typification in branch)
            {
                bool isComposite = typifications.Where(t => t.ParentId == typification.Id)
                                   .ToList()
                                   .Count() > 0;

                TypificationComponent c = factoryComponent(typification, isComposite);

                if (component.IsComposite())
                {
                    component.Add(Mount(c));
                }
                else
                {
                    component.Add(c);
                }
            }

            return(component);
        }
예제 #3
0
 public override void Add(TypificationComponent component)
 {
     Children.Add(component);
 }
 public virtual void Remove(TypificationComponent component)
 {
     throw new NotImplementedException();
 }
예제 #5
0
 public override void Remove(TypificationComponent component)
 {
     Children.Remove(component);
 }