static public void GetStartingIndex(this IArrayDefinition array, int[] indexes) { for (int i = 0; i < array.Rank; i++) { indexes[i] = array.GetLowerBound(i); } }
static public bool MoveIndex(this IArrayDefinition array, ref int x, int dimension) { x++; if (x < array.GetOutOfBound(dimension)) { return(true); } x = array.GetLowerBound(dimension); return(false); }
static public bool ContainsIndex(this IArrayDefinition array, params int[] indexes) { for (int r = 0; r < array.Rank; r++) { if (indexes[r] < array.GetLowerBound(r) || indexes[r] > array.GetUpperBound(r)) { return(false); } } return(true); }
static public bool MoveIndex(this IArrayDefinition array, int[] indexes) { indexes[array.Rank - 1]++; for (int r = array.Rank - 1; r >= 0; r--) { if (indexes[r] < array.GetOutOfBound(r)) { break; } if (r - 1 < 0) { return(false); } indexes[r] = array.GetLowerBound(r); indexes[r - 1]++; } return(true); }
static public void GetStartingIndex(this IArrayDefinition array, out int i) { i = array.GetLowerBound(0); }
static public int GetOutOfBound(this IArrayDefinition array, int dimension) { return(array.GetLowerBound(dimension) + array.GetLength(dimension)); }