Пример #1
0
 private IEnumerable<ParadoxRecord> Enumerate(ParadoxCondition condition, ushort blockId, int indexLevel)
 {
     if (indexLevel == 0)
     {
         var block = this.table.GetBlock(blockId);
         for (int i=0; i<block.RecordCount; i++)
         {
             var rec = block[i];
             if (condition.IsDataOk(rec))
             {
                 yield return rec;
             }
         }
     }
     else
     {
         var block = this.GetBlock(blockId);
         var blockIdFldIndex = this.FieldCount - 3;
         for (int i = 0; i < block.RecordCount; i++)
         {
             var rec = block[i];
             if (condition.IsIndexPossible(rec, i < block.RecordCount-1 ? block[i + 1] : null))
             {
                 var qry = Enumerate(condition, (ushort)((short) rec.DataValues[blockIdFldIndex]-1), indexLevel - 1);
                 foreach (var dataRec in qry)
                 {
                     yield return dataRec;
                 }
             }
         }
     }
 }
Пример #2
0
 private IEnumerable <ParadoxRecord> Enumerate(ParadoxCondition condition, ushort blockId, int indexLevel)
 {
     if (indexLevel == 0)
     {
         var block = this.table.GetBlock(blockId);
         for (int i = 0; i < block.RecordCount; i++)
         {
             var rec = block[i];
             if (condition.IsDataOk(rec))
             {
                 yield return(rec);
             }
         }
     }
     else
     {
         var block           = this.GetBlock(blockId);
         var blockIdFldIndex = this.FieldCount - 3;
         for (int i = 0; i < block.RecordCount; i++)
         {
             var rec = block[i];
             if (condition.IsIndexPossible(rec, i < block.RecordCount - 1 ? block[i + 1] : null))
             {
                 var qry = Enumerate(condition, (ushort)((short)rec.DataValues[blockIdFldIndex] - 1), indexLevel - 1);
                 foreach (var dataRec in qry)
                 {
                     yield return(dataRec);
                 }
             }
         }
     }
 }
Пример #3
0
 // modified by zsl: use Query Condition instead of 'Predicate<ParadoxRecord> where'
 //public IEnumerable<ParadoxRecord> Enumerate(Predicate<ParadoxRecord> where)
 public IEnumerable <ParadoxRecord> Enumerate(ParadoxCondition condition)
 {
     for (int blockId = 0; blockId < this.fileBlocks; blockId++)
     {
         var block = this.GetBlock(blockId);
         for (var recId = 0; recId < block.RecordCount; recId++)
         {
             var rec = block[recId];
             //if (where == null || where(rec))
             if (condition == null || condition.IsDataOk(rec))
             {
                 yield return(rec);
             }
         }
     }
 }
Пример #4
0
 // modified by zsl: use Query Condition instead of 'Predicate<ParadoxRecord> where'
 //public IEnumerable<ParadoxRecord> Enumerate(Predicate<ParadoxRecord> where)
 public IEnumerable<ParadoxRecord> Enumerate(ParadoxCondition condition)
 {
     for (int blockId = 0; blockId < this.fileBlocks; blockId++)
     {
         var block = this.GetBlock(blockId);
         for (var recId = 0; recId < block.RecordCount; recId++)
         {
             var rec = block[recId];
             //if (where == null || where(rec))
             if (condition == null || condition.IsDataOk(rec))
             {
                 yield return rec;
             }
         }
     }
 }