void Add(Square <K1, K2> square, V value) { Interval <int> xs = xDimension.FindIntervalIndex(square.XInterval); Interval <int> ys = yDimension.FindIntervalIndex(square.YInterval); for (int x = xs.Min; x < xs.Max; x++) { for (int y = ys.Min; y < ys.Max; y++) { if (used[x, y]) { throw new InvalidOperationException(string.Format("Inconsistende found on square [{0},{1}] could have values '{2}' or '{3}'", xDimension.Intervals[x], yDimension.Intervals[y], values[x, y], value)); } values[x, y] = value; used[x, y] = true; } } }
void Add(Cube <K1, K2, K3> cube, V value) { Interval <int> xs = xDimension.FindIntervalIndex(cube.XInterval); Interval <int> ys = yDimension.FindIntervalIndex(cube.YInterval); Interval <int> zs = zDimension.FindIntervalIndex(cube.ZInterval); for (int x = xs.Min; x < xs.Max; x++) { for (int y = ys.Min; y < ys.Max; y++) { for (int z = zs.Min; z < zs.Max; z++) { if (used[x, y, z]) { throw new InvalidOperationException(string.Format("Inconsistence found on cube [{0}, {1}, {2}], could have values '{3}' or '{4}'", xDimension.Intervals[x], yDimension.Intervals[y], zDimension.Intervals[z], values[x, y, z], value)); } values[x, y, z] = value; used[x, y, z] = true; } } } }