Ejemplo n.º 1
0
 public void Refresh()
 {
     lock (m_Lock)
     {
         var current = m_LastRecord;
         while (current != null)
         {
             current.Refresh();
             if (current.Age == 0)
             {
                 uint idx = Utility.GetHashCode(current.Keys) % c_BucketsNum;
                 m_Buckets[idx].Remove(current);
                 if (current.Previous != null)
                 {
                     current.Previous.Next = current.Next;
                 }
                 if (current.Next != null)
                 {
                     current.Next.Previous = current.Previous;
                 }
                 else
                 {
                     m_LastRecord = current.Previous;
                 }
             }
             current = current.Previous;
         }
     }
 }
Ejemplo n.º 2
0
 public StepInfoCache()
 {
     m_Buckets = new List <StepInfoCacheRecord> [c_BucketsNum];
     for (int i = 0; i < c_BucketsNum; i++)
     {
         m_Buckets[i] = new List <StepInfoCacheRecord>();
     }
     m_LastRecord = null;
     m_Lock       = new object();
 }
Ejemplo n.º 3
0
 public void Add(double step, Coordinates normal, Coordinates tangent, params object[] key)
 {
     lock (m_Lock)
     {
         uint idx    = Utility.GetHashCode(key) % c_BucketsNum;
         var  record = new StepInfoCacheRecord(key, step, normal, tangent);
         m_Buckets[idx].Add(record);
         if (m_LastRecord != null)
         {
             m_LastRecord.Next = record;
             record.Previous   = m_LastRecord;
         }
         m_LastRecord = record;
     }
 }