public List <PersonComponent> DoAlgorithm(EmployeeModel element)
        {
            Stack <PersonComponent> stack = new Stack <PersonComponent>();

            stack.Push(element);
            while (stack.Count > 0)
            {
                PersonComponent current = stack.Pop();
                sortedList.Add(current);

                foreach (PersonComponent child in current.Subordinates)
                {
                    stack.Push(child);
                }
            }
            return(sortedList);
        }
        public List <PersonComponent> DoAlgorithm(EmployeeModel element)
        {
            Queue <PersonComponent> queue = new Queue <PersonComponent>();

            queue.Enqueue(element);
            while (queue.Count > 0)
            {
                PersonComponent current = queue.Dequeue();
                sortedList.Add(current);

                foreach (PersonComponent child in current.Subordinates)
                {
                    queue.Enqueue(child);
                }
            }
            return(sortedList);
        }
 public DirectSubordinationStrategy(EmployeeModel element)
 {
     this.element = element;
 }
Пример #4
0
 public override void Remove(PersonComponent subordinate)
 {
 }
Пример #5
0
 public override void Add(PersonComponent subordinate)
 {
 }
Пример #6
0
 public abstract void Remove(PersonComponent subordinate);
Пример #7
0
 public abstract void Add(PersonComponent subordinate);
 public ShowByHeightStrategy(EmployeeModel element)
 {
     this.element = element;
 }