Пример #1
0
        public ReadSpec GetReadSpec(RCSymbol symbol, int limit, bool force, bool fill)
        {
            ReadSpec result = new ReadSpec(this, limit, force, fill);

            if (limit == 0)
            {
                limit = int.MaxValue;
            }
            for (int i = 0; i < symbol.Count; ++i)
            {
                CountRecord current = Get(symbol[i]);
                if (current != null)
                {
                    // Start searching from the first known record.
                    result.Add(symbol[i], current.start, limit);
                }
                else
                {
                    // In this case we know there is no data so any search should begin
                    // from the end of time.
                    result.Add(symbol[i], _dispatched.Count, limit);
                }
            }
            return(result);
        }
Пример #2
0
        public Reader(RCCube source, ReadSpec spec, ReadCounter counter, bool forceGCol, int end)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (spec == null)
            {
                throw new ArgumentNullException("spec");
            }
            if (counter == null)
            {
                throw new ArgumentNullException("counter");
            }

            _source  = source;
            _spec    = spec;
            _counter = counter;
            _end     = end;
            RCArray <string> axisCols = new RCArray <string> (source.Axis.Colset);

            if (forceGCol)
            {
                axisCols.Write("G");
            }
            if (_source.Axis.Global != null && _source.Axis.Count > 0)
            {
                _initg = _source.Axis.Global[0];
            }
            _target = new RCCube(axisCols);
        }
Пример #3
0
        public ReadSpec GetReadSpec(RCSymbol symbol, RCLong starts, bool force, bool fill)
        {
            ReadSpec result = new ReadSpec(this, 0, force, fill);

            for (int i = 0; i < symbol.Count; ++i)
            {
                result.Add(symbol[i], (int)starts[i], int.MaxValue);
            }
            return(result);
        }
Пример #4
0
 public Satisfy CanSatisfy(ReadSpec spec)
 {
     if (spec.IgnoreDispatchedRows)
     {
         if (spec.SymbolUnlimited)
         {
             foreach (SpecRecord specRecord in spec)
             {
                 // CountRecord countRecord = Get (specRecord.symbol);
                 CountRecord countRecord = Get(specRecord);
                 // The symbol is missing entirely.
                 if (countRecord == null)
                 {
                     continue;
                 }
                 // If there are zero rows for the symbol then we are never satsified.
                 if (countRecord.count > 0)
                 {
                     return(Satisfy.Yes);
                 }
             }
             return(Satisfy.No);
         }
         else
         {
             foreach (SpecRecord specRecord in spec)
             {
                 // CountRecord countRecord = Get (specRecord.symbol);
                 CountRecord countRecord = Get(specRecord);
                 // The symbol is missing entirely.
                 if (countRecord == null)
                 {
                     return(Satisfy.No);
                 }
                 // If there are zero rows for the symbol then we are never satsified.
                 if (countRecord.count == 0)
                 {
                     return(Satisfy.No);
                 }
                 // We will accept any number of them.
                 if (specRecord.limit == int.MaxValue)
                 {
                     continue;
                 }
                 // There are not enough records to satisfy the spec for this symbol.
                 if (countRecord.count < specRecord.limit)
                 {
                     return(Satisfy.No);
                 }
             }
         }
     }
     else
     {
         if (spec.SymbolUnlimited)
         {
             foreach (SpecRecord specRecord in spec)
             {
                 // CountRecord countRecord = Get (specRecord.symbol);
                 CountRecord countRecord = Get(specRecord);
                 // The symbol is missing entirely.
                 if (countRecord == null)
                 {
                     continue;
                 }
                 // Notice that while dispatching we look at count. Here at total.
                 if (countRecord.total > 0)
                 {
                     if (specRecord.start == 0)
                     {
                         return(Satisfy.Yes);
                     }
                     else
                     {
                         return(Satisfy.Maybe);
                     }
                 }
             }
             return(Satisfy.No);
         }
         else
         {
             if (spec.RecordCount > 0)
             {
                 foreach (SpecRecord specRecord in spec)
                 {
                     CountRecord countRecord = Get(specRecord);
                     // The symbol is missing entirely.
                     if (countRecord == null)
                     {
                         return(Satisfy.No);
                     }
                     // Check there are enough records to satisfy the spec for this symbol.
                     if (specRecord.start == 0)
                     {
                         // We will accept any number of them.
                         if (specRecord.limit == int.MaxValue)
                         {
                             continue;
                         }
                         if (countRecord.total < specRecord.limit)
                         {
                             return(Satisfy.No);
                         }
                     }
                     else
                     {
                         // This is for the case where you use read or last from an arbitrary start
                         // point.
                         // Since we don't track where the symbols are in this counter, we won't
                         // know whether
                         // The query would be satisfied.  We just have to do it and see.
                         return(Satisfy.Maybe);
                     }
                 }
             }
             else
             {
                 return(Satisfy.No);
             }
         }
     }
     return(Satisfy.Yes);
 }