public static bool isEven(TreeComponent currNode)
        {
            if (currNode.GetChilds() == null && currNode.number % 2 == 0)
            {
                return(true);
            }

            if (currNode.number % 2 == 0)
            {
                bool currEven = true;

                foreach (TreeComponent c in currNode.GetChilds())
                {
                    currEven = currEven && isEven(c);
                }

                return(currEven);
            }

            return(false);
        }
Пример #2
0
 public override void RemoveChild(TreeComponent c)
 {
     throw new NotSupportedException("Leaf elemnt cannot remove child!");
 }
Пример #3
0
 public abstract void RemoveChild(TreeComponent c);
Пример #4
0
 public abstract void AddChild(TreeComponent c);
Пример #5
0
 public override void RemoveChild(TreeComponent c)
 {
     childs.Remove(c);
 }
Пример #6
0
 public override void AddChild(TreeComponent c)
 {
     childs.Add(c);
 }