Пример #1
0
 private void InitBlock(TimeSeriesImpl enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Пример #2
0
 internal TimeSeriesReverseIterator(TimeSeriesImpl enclosingInstance, long from, long till)
 {
     InitBlock(enclosingInstance);
     pos = -1;
     this.from = from;
     blockIterator = Enclosing_Instance.index.GetEnumerator(new Key(from - Enclosing_Instance.maxBlockTimeInterval), new Key(till), IndexSortOrder.Descent);
     //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'IEnumerator.MoveNext' which has a different behavior.
     while (blockIterator.MoveNext())
     {
         //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'IEnumerator.Current' which has a different behavior.
         TimeSeriesBlock block = (TimeSeriesBlock) blockIterator.Current;
         int n = block.used;
         TimeSeriesTick[] e = block.Ticks;
         int l = 0, r = n;
         while (l < r)
         {
             int i = (l + r) >> 1;
             if (till >= e[i].Time)
             {
                 l = i + 1;
             }
             else
             {
                 r = i;
             }
         }
         Assert.That(l == r && (l == n || e[l].Time > till));
         if (l > 0)
         {
             if (e[l - 1].Time >= from)
             {
                 pos = l - 1;
                 currBlock = block;
             }
             return;
         }
     }
 }