namespace Bts.DataStream; using BCG; using bts.api.core; using Bts.DataStreamCore; using System; using System.Collections; using System.Collections.Generic; public class TableUpdateDataPacket : IDataPacket where T : IBlueRow { readonly TableUpdate table; readonly IBlueTableSchema schema; public TableUpdateDataPacket(TableUpdate table, IBlueTableSchema schema) { this.table = table; this.schema = schema; } public IBlueRowCollection newRows { get { var rv = new BlueTableImmutable(schema); return rv; } } public IBlueRowCollection addedRows => throw new NotImplementedException(); public IBlueRowCollection deletedRows => throw new NotImplementedException(); class MyRowCollection : IBlueRowCollection { readonly TableUpdate table; readonly IEnumerable items; Lazy> itemList; public MyRowCollection(IEnumerable items, IBlueTableSchema schema) { this.items = items; this.schema = schema; itemList = new(() => { var rv = new SortedList(); foreach (var item in this.items) { rv.Add(item.Id(), item); } return rv; }); } public int Count => itemList.Value.Count; public bool IsSynchronized => false; public object SyncRoot => this; public T this[int id] => itemList.Value[id]; public IBlueTableSchema schema { get; } public bool containsID(int id) => itemList.Value.ContainsKey(id); public void CopyTo(Array array, int index) { } public IEnumerator GetEnumerator() { throw new NotImplementedException(); } IEnumerator IEnumerable.GetEnumerator() { throw new NotImplementedException(); } } }