Example #1
0
 public void ForEachInOrder(NodeValueAction action)
 {
     if (Left != null)
     {
         Left.ForEachInOrder(action);
     }
     action(x);
     if (Right != null)
     {
         Right.ForEachInOrder(action);
     }
 }
Example #2
0
 public void ForEachGreaterThan(int min, NodeValueAction action)
 {
     if (Left != null && x > min)
     {
         Left.ForEachGreaterThan(min, action);
     }
     if (x > min)
     {
         action(x);
     }
     if (Right != null)
     {
         Right.ForEachGreaterThan(min, action);
     }
 }
Example #3
0
 public void ForEachLessThan(int max, NodeValueAction action)
 {
     if (Left != null)
     {
         Left.ForEachLessThan(max, action);
     }
     if (x < max)
     {
         action(x);
     }
     if (Right != null && x < max)
     {
         Right.ForEachLessThan(max, action);
     }
 }
Example #4
0
        public void ForEachInOrderBetween(int min, int max, NodeValueAction action)
        {
            if (Left != null && min < x)
            {
                Left.ForEachInOrderBetween(min, max, action);
            }

            if (min <= x && x <= max)
            {
                action(x);
            }

            if (Right != null && x < max)
            {
                Right.ForEachInOrderBetween(min, max, action);
            }
        }
Example #5
0
 public void ForEachLessThan(int max, NodeValueAction action)
 {
     if (Left != null)
         Left.ForEachLessThan(max, action);
     if (x < max)
         action(x);
     if (Right != null && x < max)
         Right.ForEachLessThan(max, action);
 }
Example #6
0
        public void ForEachInOrderBetween(int min, int max, NodeValueAction action)
        {
            if (Left != null && min < x)
                Left.ForEachInOrderBetween(min, max, action);

            if (min <= x && x <= max)
                action(x);

            if (Right != null && x < max)
                Right.ForEachInOrderBetween(min, max, action);
        }
Example #7
0
 public void ForEachInOrder(NodeValueAction action)
 {
     if (Left != null)
         Left.ForEachInOrder(action);
     action(x);
     if (Right != null)
         Right.ForEachInOrder(action);
 }
Example #8
0
 public void ForEachGreaterThan(int min, NodeValueAction action)
 {
     if (Left != null && x > min)
         Left.ForEachGreaterThan(min, action);
     if (x > min)
         action(x);
     if (Right != null)
         Right.ForEachGreaterThan(min, action);
 }