public override void BeforeRow(long e, RCTimeScalar t, RCSymbolScalar symbol, int row) { if (_source.Axis.Has("G")) { _row = new RCBlock(RCBlock.Empty, "G", ":", new RCLong(_source.Axis.Global[row])); } if (_source.Axis.Has("E")) { _row = new RCBlock(_row, "E", ":", new RCLong(_source.Axis.Event[row])); } if (_source.Axis.Has("T")) { _row = new RCBlock(_row, "T", ":", new RCTime(_source.Axis.Time[row])); } if (_source.Axis.Has("S")) { // Include S as both a field on the row blocks and as the names of the rows // themselves // This is so that you can get back to what you had with "flip block $my_cube" // While also being able to treat the result of "block $my_cube" as a dictionary // if you wish _row = new RCBlock(_row, "S", ":", new RCSymbol(_source.Axis.Symbol[row])); _rowName = _source.Axis.Symbol[row].Key.ToString(); } }
public override void AfterRow(long e, RCTimeScalar t, RCSymbolScalar symbol, int row) { if (!_writeAxis) { return; } long g = _initg + row; // I think this needs to change to a sequence number. 2015.06.03 e = _e; // I need a unit test for not incrementing this after each row. ++_e; // This needs to change to a sequence number but // the _e logic is not quite right yet. 2015.09.17 if (_source.Axis.Has("E")) { e = _source.Axis.Event[row]; } // Things I do not understand, why doesn't every row have the same g? // Why does G reset to zero after clearing, even though initg > 0? // I think it is probably correct internally but that the reader below assigns G // based on its own count. // No it's even worse than that, there isn't and never has been any G row at all on // the // blackboard cubes. Wow. // So to solve this initially I can add _initg to row to get g. // But ultimately we need to make G truly global. long targetLastG = -1; if (_target.Axis.Global != null && _target.Axis.Global.Count > 0) { targetLastG = Math.Abs(_target.Axis.Global[_target.Axis.Global.Count - 1]); } if (_source.Axis.Has("G")) { // This means force specific G values into the blackboard. // This could be good or bad. if (_source.Axis.Global[row] <= targetLastG) { throw new Exception("G values may not be written out of order."); } g = _source.Axis.Global[row]; } else if (targetLastG > -1) { g = targetLastG + 1; } if (_delete) { g = -g; } // I just moved this from the top of the function to the bottom // The tests are ok but I keep this note til all the concurrency examples run if (_counter != null) { _counter.Write(symbol, (int)g); } _target.Axis.Write(g, e, t, symbol); }
public override void AfterRow(long e, RCTimeScalar t, RCSymbolScalar s, int row) { if (_rowChanged) { long g = -1; _target.Write(g, e, t, s); } }
public override void AfterRow(long e, RCTimeScalar t, RCSymbolScalar s, int row) { if (_indicator) { long g = -1; _target.Write(g, e, t, s); } _indicator = false; }
public override void AfterRow(long e, RCTimeScalar t, RCSymbolScalar s, int row) { if (_indicator[row]) { // g needs to be included in the signature above. long g = -1; _target.Write(g, e, t, s); } }
public void Write(RCTimeScalar t, RCSymbolScalar s) { // You will get an exception if these arrays have been locked from writing. if (Time != null) { Time.Write(t); } if (Symbol != null) { Symbol.Write(s); } ++_count; }
public RCTimeScalar GetTime(string name, RCTimeScalar def) { RCTime val = (RCTime)Get(name); if (val == null) { return(def); } else { return(val[0]); } }
public void CheckTimeIsBetween(string name, RCTimeScalar min, RCTimeScalar max) { RCTimeScalar val = GetTime(name); if (val.Ticks < min.Ticks || val.Ticks > max.Ticks) { throw new Exception(string.Format( "The variable '{0}' is not between {1} and {2}. Value is {3}.", name, min, max, val)); } }
public static RCArray <RCTimeScalar> ReadVectorTime(RCArray <byte> data, ref int start) { int count = BitConverter.ToInt32(data._source, start); start += sizeof(int); RCTimeScalar[] result = new RCTimeScalar[count]; for (int i = 0; i < result.Length; ++i) { RCTimeScalar val = ReadScalarTime(data, start); result[i] = val; start += 12; } return(new RCArray <RCTimeScalar> (result)); }
public override void TimeCol(RCTimeScalar time) { if (!_args.Showt) { return; } string scalar = time.ToString(); int max = _max[_col]; if (scalar.Length > max) { _max[_col] = scalar.Length; } _columns[_col].Add(scalar); _col = (_col + 1) % _names.Count; }
public override void AfterRow(long e, RCTimeScalar t, RCSymbolScalar s, int row) { if (!_accept) { return; } // Do this after writing the individual cells, // the correct behavior of WriteCell depends on it. // Do not pass the counter here. long g = row; if (_source.Axis.Global != null) { g = _source.Axis.Global[row]; } _target.Write(g, e, t, s); }
public override void BeforeRow(long e, RCTimeScalar t, RCSymbolScalar s, int row) { bool found; int vrow = _locator.Index.BinarySearch(row, out found); if (found && vrow < _locator.Index.Count) { _indicator = (bool)_locator.BoxCell(vrow); _last[s] = _indicator; } else { if (!_last.TryGetValue(s, out _indicator)) { _indicator = false; } } }
public void Write(long g, long e, RCTimeScalar t, RCSymbolScalar s) { if (Global != null) { Global.Write(g); } if (Event != null) { Event.Write(e); } if (Time != null) { Time.Write(t); } if (Symbol != null) { Symbol.Write(s); } ++_count; }
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; } }
public override void BeforeRow(long e, RCTimeScalar t, RCSymbolScalar s, int row) { _rowChanged = false; _symbol = s; }
public override void AfterRow(long e, RCTimeScalar t, RCSymbolScalar s, int row) { ++_row; }
public override void BeforeRow(long e, RCTimeScalar t, RCSymbolScalar s, int row) { _writeAxis = false; _delete = false; }
public override void AfterRow(long e, RCTimeScalar t, RCSymbolScalar s, int row) { _target = new RCBlock(_target, _rowName, ":", _row); _row = RCBlock.Empty; _rowName = ""; }