示例#1
0
 public void IntersectsWith(long value, int bitFlag, ref List <T> results)
 {
     if (this.m_Dirty)
     {
         this.m_Root  = new IntervalNode <T>(this.m_Nodes);
         this.m_Dirty = false;
     }
     this.m_Root.Query(value, bitFlag, ref results);
 }
示例#2
0
 public IntervalNode(ICollection <T> items)
 {
     if (items.Count != 0)
     {
         long num  = 9223372036854775807L;
         long num2 = -9223372036854775808L;
         foreach (T current in items)
         {
             num  = Math.Min(num, current.intervalStart);
             num2 = Math.Max(num2, current.intervalEnd);
         }
         this.m_Center   = (num2 + num) / 2L;
         this.m_Children = new List <T>();
         List <T> list  = new List <T>();
         List <T> list2 = new List <T>();
         foreach (T current2 in items)
         {
             if (current2.intervalEnd < this.m_Center)
             {
                 list.Add(current2);
             }
             else if (current2.intervalStart > this.m_Center)
             {
                 list2.Add(current2);
             }
             else
             {
                 this.m_Children.Add(current2);
             }
         }
         if (this.m_Children.Count == 0)
         {
             this.m_Children = null;
         }
         if (list.Count > 0)
         {
             this.m_LeftNode = new IntervalNode <T>(list);
         }
         if (list2.Count > 0)
         {
             this.m_RightNode = new IntervalNode <T>(list2);
         }
     }
 }
 public IntervalNode(ICollection <T> items)
 {
     if (items.Count != 0)
     {
         long num  = long.MaxValue;
         long num2 = long.MinValue;
         foreach (T t in items)
         {
             num  = Math.Min(num, t.intervalStart);
             num2 = Math.Max(num2, t.intervalEnd);
         }
         this.m_Center   = (num2 + num) / 2L;
         this.m_Children = new List <T>();
         List <T> list  = new List <T>();
         List <T> list2 = new List <T>();
         foreach (T item in items)
         {
             if (item.intervalEnd < this.m_Center)
             {
                 list.Add(item);
             }
             else if (item.intervalStart > this.m_Center)
             {
                 list2.Add(item);
             }
             else
             {
                 this.m_Children.Add(item);
             }
         }
         if (this.m_Children.Count == 0)
         {
             this.m_Children = null;
         }
         if (list.Count > 0)
         {
             this.m_LeftNode = new IntervalNode <T>(list);
         }
         if (list2.Count > 0)
         {
             this.m_RightNode = new IntervalNode <T>(list2);
         }
     }
 }