Exemplo n.º 1
0
        public CountRecord Get(SpecRecord spec)
        {
            CountRecord result;

            if (spec.Concrete)
            {
                _records.TryGetValue(spec.symbol, out result);
            }
            else
            {
                _abstracts.TryGetValue(spec.symbol, out result);
            }
            return(result);
        }
Exemplo n.º 2
0
        public void Add(RCSymbolScalar scalar, int start, int limit)
        {
            SpecRecord record = new SpecRecord(scalar);

            record.start = start;
            record.limit = limit;
            if (start < _start)
            {
                _start = start;
            }
            RCSymbolScalar current = scalar;

            while (current != null)
            {
                _records[current] = record;
                current           = current.Previous;
            }
            // What happens if you pass multiple identical symbols? boom!
            // Jan 4 2015 - we really need a test for that!
            // _records[record.symbol] = record;
        }
Exemplo n.º 3
0
        public override void BeforeRow(long e, RCTimeScalar t, RCSymbolScalar s, int row)
        {
            _accept = false;
            // This will get any matching wild card symbol in the spec.
            SpecRecord spec = _spec.Get(s);

            // If the symbol does not match anything in _spec then move on.
            if (spec == null)
            {
                return;
            }
            // If we are too early for the symbol then move on.
            if ((_initg + row) < spec.start)
            {
                return;
            }
            // If we already have enough of this symbol then move on.
            // Don't forget to update this counter when accepting rows.
            // ReadSpec.Get is going to do this for you now.
            // if (spec.count >= spec.limit) return;
            // Was this line already read in the case of dispatch, if so move on.
            if (_spec.IgnoreDispatchedRows && _counter.WasDispatched(row))
            {
                return;
            }

            // We need some way to break out of the loop here rather than keep going to the end.
            if (_inLines.Count >= _spec.TotalLimit)
            {
                return;
            }
            // This row would be accepted but we are supposed to skip the first
            // _skipCount rows.
            if (_skipCount < _spec.SkipFirst)
            {
                ++_skipCount;
                return;
            }
            _accept = true;
            _symbol = s;
            _inLines.Write(row);
            long inCount = 0;

            // _inSymbols will not be populated if there is no timeline.
            if (s != null)
            {
                _inSymbols.TryGetValue(s, out inCount);
                _inSymbols[s] = inCount++;
            }
            ++spec.count;
            _fill = false;
            // if inCount is one then this is the first row and we need to fill in values from
            // prior
            // states.
            // if symbol == null then every single row and column needs to be included in the
            // output.
            if (_spec.Fill && inCount == 1)
            {
                _fill = true;
            }
            else
            {
                _fill = false;
            }
        }