예제 #1
0
            static bool OptionEqual(IOption thisOption, IOption otherOption)
            {
                if (thisOption is not IOption2 thisOption2 ||
                    otherOption is not IOption2 otherOption2)
                {
                    // Third party definition of 'IOption'.
                    return(thisOption.Equals(otherOption));
                }

                return(thisOption2.Equals(otherOption2));
            }
예제 #2
0
        public bool Add(IOption option)
        {
            if (option == null || option.Equals(null))
            {
                return(false);
            }

            var id = option.NameId;

            if (Contains(id))
            {
                return(false);
            }

            m_options.Add(id, option);

            return(true);
        }
예제 #3
0
 public bool FindNodeByValue(T toFind, out BTreeOption <T>?node, bool fromRight = true)
 {
     if (value.Equals(toFind))
     {
         node = this;
         return(true);
     }
     else
     {
         if (((fromRight && right.HasValue(out BTreeOption <T> child)) || (!fromRight && left.HasValue(out child))) && child.FindNodeByValue(toFind, out node, fromRight))
         {
             return(true);
         }
         else
         {
             node = null;
             return(false);
         }
     }
 }