protected void FormatArray(Thread target, TargetArrayObject aobj, TargetArrayBounds bounds, int dimension, int[] indices) { Append("[ "); indent_level += 3; bool first = true; int[] new_indices = new int [dimension + 1]; indices.CopyTo(new_indices, 0); int lower, upper; if (!bounds.IsMultiDimensional) { lower = 0; upper = bounds.Length - 1; } else { lower = bounds.LowerBounds [dimension]; upper = bounds.UpperBounds [dimension]; } for (int i = lower; i <= upper; i++) { if (!first) { Append(", "); CheckLineWrap(); } first = false; new_indices [dimension] = i; if (dimension + 1 < bounds.Rank) { FormatArray(target, aobj, bounds, dimension + 1, new_indices); } else { TargetObject eobj = aobj.GetElement(target, new_indices); FormatObjectRecursed(target, eobj, false); } } Append(first ? "]" : " ]"); indent_level -= 3; }
AbstractVariable GetChildNode(int index) { int[] newIndices = new int[dimension + 1]; indicesPefix.CopyTo(newIndices, 0); newIndices[dimension] = index; if (newIndices.Length == obj.Type.Rank) { // We have reached the last dimension - create the element TargetObject element; try { element = obj.GetElement(stackFrame.Thread, newIndices); } catch { return(new ErrorVariable(IndicesToString(newIndices), "Can not get array element")); } return(VariableFactory.Create(IndicesToString(newIndices), element, stackFrame)); } else { // Create a subset for the next dimension return(new ArraySubsetVariable(stackFrame, obj, newIndices)); } }
public object GetElement(int[] indices) { return(array.GetElement(ctx.Thread, indices)); }