Files
spark/src/DataStreamSuite/DataStream/Primitives/StaticCollectionStream/MutableStream.cs
T
John Colvin e95997ea17 cleanup: Chip away a few nullability warnings in DataStreamSuite
This is a start, but there're still > 700 of them!
2024-05-25 15:37:33 +00:00

47 lines
1.3 KiB
C#

using System;
namespace BCG
{
/// <summary>
/// A more complete and 'correct' version of BlueRowCollectionStaticStream. Should replace it finally, though
/// at this time, to expedite the process, both exist simultaniously
/// </summary>
public class MutableStream : ViewStream
{
public MutableStream () {}
public MutableStream (IBlueRowCollection rows)
{
loadCollection (rows);
}
/// <summary>
/// Fires a datapacket with newRows set to the argument, and the whole previous state (if existed)
/// set as the deletedRows.
/// </summary>
/// <param name="rows"></param>
public void loadCollection (IBlueRowCollection rows)
{
myFireEvent(new DataPacket(
rows,
new BlueTable(rows),
myLastValue is DataPacket dp
? new BlueTable(dp.newRows)
: new BlueTable(rows.schema)));
}
/// <summary>
/// Fires the whole datapacket as one. Its the callers responsibility to make sure that it makes incremental sense
/// </summary>
/// <param name="dp"></param>
public void loadPacket (DataPacket dp) {myFireEvent (dp);}
protected override void myOnFirstSubscriber()
{
if (myLastValue != null)
loadPacket (myLastValue as DataPacket);
}
}
}