public bool Present(T target)
 {
     if (_enabled && _value.Equals(target))
     {
         return(true);
     }
     if (_left != null && _value.CompareTo(target) >= 0)
     {
         return(_left.Present(target));
     }
     if (_right != null && _value.CompareTo(target) < 0)
     {
         return(_right.Present(target));
     }
     return(false);
 }
示例#2
0
 public void TestPresent()
 {
     Assert.IsTrue(tree.Present(8));
     Assert.IsFalse(tree.Present(-26));
 }