Esempio n. 1
0
 public void AddComponent(Component originalComponent, Component addedComponent)
 {
     if (originalComponent.IsComposite())
     {
         originalComponent.Add(addedComponent);
     }
     Console.WriteLine($"RESULT:{originalComponent.Display()}");
 }
Esempio n. 2
0
 public void ClientCode2(Component component1, Component component2)
 {
     if (component1.IsComposite())
     {
         component1.Add(component2);
     }
     Console.WriteLine($"RESULT: {component1.Operation()}");
 }
        public void GetElementofComponent(Component component1, int index)
        {
            if (component1.IsComposite())
            {
                component1.GetChild(index);
            }

            Console.WriteLine($"Result: {component1.Operation()}");
        }
        public void RemoveComponentofComponent(Component component1, Component component2)
        {
            if (component1.IsComposite())
            {
                component1.Remove(component2);
            }

            Console.WriteLine($"Result: {component1.Operation()}");
        }
        //ADICIONA UM COMPONENTE A OUTRO COMPONENTE
        public void AddComponentToComponent(Component component1, Component component2)
        {
            if (component1.IsComposite())
            {
                component1.Add(component2);
            }

            Console.WriteLine($"Result: {component1.Operation()}");
        }
Esempio n. 6
0
        public void ClientCode2(Component component, Component component2)
        {
            if (component.IsComposite())
            {
                component.Add(component2);
            }

            Console.WriteLine($"Result: {component.Operation()}\r\n");
        }