Merging changes
This commit is contained in:
1 parent
c4216d2272
commit
797816be7e
437 files changed
+54228
-28
No files matched your search
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BCG
|
||||
{
|
||||
public class SparseVectorBlueTable : IBlueRowCollection
|
||||
{
|
||||
private List<IBlueRow> _rows = new List<IBlueRow>(50);
|
||||
|
||||
public SparseVectorBlueTable(IBlueTableSchema schema) {
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
public void reserve(int length) {
|
||||
if (_rows.Capacity < length) {
|
||||
_rows.Capacity += 1024;
|
||||
}
|
||||
while (_rows.Count <= length) {
|
||||
_rows.Add(null);
|
||||
}
|
||||
}
|
||||
|
||||
public IBlueRow this[int id] {
|
||||
get {
|
||||
return _rows[id];
|
||||
}
|
||||
set {
|
||||
this.reserve(id);
|
||||
_rows[id] = value;
|
||||
}
|
||||
}
|
||||
public IBlueTableSchema schema { get; private set; }
|
||||
public bool containsID(int id) {
|
||||
return (id >= 0 && id < _rows.Count && this[id] != null);
|
||||
}
|
||||
|
||||
public void CopyTo(Array array, int index) { _rows.CopyTo((IBlueRow[])array, index);}
|
||||
public int Count { get { return _rows.Count; } }
|
||||
public bool IsSynchronized {get { return false; }}
|
||||
public object SyncRoot { get { return this; } }
|
||||
public System.Collections.IEnumerator GetEnumerator() { return _rows.Where(r => r != null).GetEnumerator(); }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user