Merging changes

This commit is contained in:
Taha committed 2023-09-04 16:25:40 -04:00
1 parent c4216d2272
commit 797816be7e
437 files changed
+54228 -28

No files matched your search

@@ -0,0 +1,65 @@
using System;
using System.Collections;
namespace BCG
{
/// <summary>
/// Optimized for the scneario when id's are sequential starting from 0 (no indexing is necessary etc)
/// </summary>
public class SequentialIDBlueTable : IBlueRowCollection
{
private IBlueRow[] myRows;
private IBlueTableSchema mySchema;
/// <summary>
/// The refernce to the rows is kept. So if user wants to reuse the variable, its best
/// to pass in a copied value
/// </summary>
/// <param name="schema"></param>
/// <param name="rows"></param>
public SequentialIDBlueTable (IBlueTableSchema schema, IBlueRow[] rows)
{
myRows = rows;
mySchema = schema;
}
public SequentialIDBlueTable(IBlueTableSchema schema, System.Collections.Generic.IReadOnlyList<object[]> rows)
{
mySchema = schema;
myRows = new IBlueRow[rows.Count];
for (int i = 0; i < myRows.Length; i++)
myRows[i] = new BlueRow(mySchema, rows[i]);
}
#region IBlueRowCollection Members
public IBlueRow this[int id] { get { return myRows[id]; } }
public IBlueTableSchema schema {get {return mySchema;}}
public bool containsID (int id)
{
return id > -1 && id < myRows.Length;
}
#endregion
#region ICollection Members
public bool IsSynchronized {get {return false;}}
public int Count {get {return myRows.Length;}}
public void CopyTo (Array array, int index) {myRows.CopyTo (array, index);}
public object SyncRoot {get {return null;}}
#endregion
#region IEnumerable Members
public System.Collections.IEnumerator GetEnumerator() {return myRows.GetEnumerator ();}
#endregion
}
}