public void PutCell(K1 k1, K2 k2, C c) { int i1 = 0; if (!Keys1.TryGetBySecond(k1, out i1)) { int new1 = Keys1.First.Any() ? Keys1.First.Max() + 1 : 0; Keys1.Add(new1, k1); i1 = new1; } int i2 = 0; if (!Keys2.TryGetBySecond(k2, out i2)) { int new2 = Keys2.First.Any() ? Keys2.First.Max() + 1 : 0; Keys2.Add(new2, k2); i2 = new2; } var tuple = new Tuple <int, int>(i1, i2); Cells.Remove(tuple); Cells.Add(tuple, c); }
public IEnumerable <RFDataCell> GetCells() { return(Cells.Select(c => new RFDataCell { K1 = Keys1.GetByFirst(c.Key.Item1), K2 = Keys2.GetByFirst(c.Key.Item2), C = c.Value })); }
public C GetCell(K1 k1, K2 k2) { if (Keys1.ContainsSecond(k1) && Keys2.ContainsSecond(k2)) { var i1 = Keys1.GetBySecond(k1); var i2 = Keys2.GetBySecond(k2); var tuple = new Tuple <int, int>(i1, i2); if (Cells.ContainsKey(tuple)) { return(Cells[tuple]); } } return(default(C)); }