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);
        }
Exemplo n.º 3
0
 public override void Add(TypificationComponent component)
 {
     Children.Add(component);
 }
 public virtual void Remove(TypificationComponent component)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 5
0
 public override void Remove(TypificationComponent component)
 {
     Children.Remove(component);
 }