public void EraseRange(long firstKeyIndex, long lastKeyIndex)
 {
     if (firstKeyIndex < 0)
     {
         firstKeyIndex = 0;
     }
     if (lastKeyIndex >= GetKeyValueCount())
     {
         lastKeyIndex = _prefixKeyCount - 1;
     }
     if (lastKeyIndex < firstKeyIndex)
     {
         return;
     }
     MakeWritable();
     firstKeyIndex += _prefixKeyStart;
     lastKeyIndex  += _prefixKeyStart;
     if (_cursor2 == null)
     {
         _cursor2 = ArtRoot.CreateCursor();
     }
     _cursor.SeekIndex(firstKeyIndex);
     _cursor2.SeekIndex(lastKeyIndex);
     _cursor.EraseTo(_cursor2);
     InvalidateCurrentKey();
     _prefixKeyCount -= lastKeyIndex - firstKeyIndex + 1;
 }
 public long GetKeyValueCount()
 {
     if (_prefixKeyCount >= 0)
     {
         return(_prefixKeyCount);
     }
     if (_prefix.Length == 0)
     {
         _prefixKeyCount = ArtRoot.GetCount();
         return(_prefixKeyCount);
     }
     CalcPrefixKeyStart();
     if (_prefixKeyStart < 0)
     {
         _prefixKeyCount = 0;
         return(0);
     }
     if (_cursor2 == null)
     {
         _cursor2 = ArtRoot.CreateCursor();
     }
     _cursor2.FindLast(_prefix);
     _prefixKeyCount = _cursor2.CalcIndex() - _prefixKeyStart + 1;
     return(_prefixKeyCount);
 }
 public void SetUlong(uint idx, ulong value)
 {
     if (ArtRoot.GetUlong(idx) != value)
     {
         MakeWritable();
         ArtRoot.SetUlong(idx, value);
     }
 }
 void CalcPrefixKeyStart()
 {
     if (_prefixKeyStart >= 0)
     {
         return;
     }
     if (_cursor2 == null)
     {
         _cursor2 = ArtRoot.CreateCursor();
     }
     if (_cursor2.FindFirst(_prefix))
     {
         _prefixKeyStart = _cursor2.CalcIndex();
     }
     else
     {
         _prefixKeyStart = -1;
     }
 }
 public uint GetUlongCount()
 {
     return(ArtRoot.GetUlongCount());
 }
 public ulong GetUlong(uint idx)
 {
     return(ArtRoot.GetUlong(idx));
 }