/* immutable */ class Complex { double re, im; } class NewTest { static void printP1(Point<1> p) { // System.out.print("["); // System.out.print(p[1]); // System.out.print("]"); } static void printlnRD1(RectDomain<1> R) { // System.out.print("["); printP1(R.min()); // System.out.print(" : "); printP1(R.max()); if (R.stride() > [1]) { // System.out.print(" : "); printP1(R.stride()); } // System.out.println("]"); } static void printP2(Point<2> p) { // System.out.print("["); // System.out.print(p[1]); // System.out.print(", "); // System.out.print(p[2]); // System.out.print("]"); } static void printlnRD2(RectDomain<2> R) { // System.out.print("["); printP2(R.min()); // System.out.print(" : "); printP2(R.max()); if (R.stride() > [1, 1]) { // System.out.print(" : "); printP2(R.stride()); } // System.out.println("]"); } static void printP3(Point<3> p) { // System.out.print("["); // System.out.print(p[1]); // System.out.print(", "); // System.out.print(p[2]); // System.out.print(", "); // System.out.print(p[3]); // System.out.print("]"); } static void printlnRD3(RectDomain<3> R) { // System.out.print("["); printP3(R.min()); // System.out.print(" : "); printP3(R.max()); if (R.stride() > [1, 1, 1]) { // System.out.print(" : "); printP3(R.stride()); } // System.out.println("]"); } public static void main( String[] argv ) { int i; int [3d] a; int [3d] [1d] b; int [2d] [3d] [1d] e; int [2d] [] j; int [] [2d] k; Complex [3d] c; RectDomain<3> R3 = [0 : 3, 0 : 3, 0 : 3]; RectDomain<1> R1 = [5 : 10]; RectDomain<2> R2 = [4 : 5, 8 : 9]; a = new int[R3]; // System.out.print("a.domain() = "); printlnRD3(a.domain()); b = new int[R3][R1]; // System.out.print("b.domain() = "); printlnRD3(b.domain()); foreach (m in b.domain()) { // System.out.print("b"); printP3(m); // System.out.print(".domain() = "); printlnRD1(b[m].domain()); } c = new Complex[R3]; c = (new Complex[R1][R3])[R1.min()]; e = new int[R2][R3][[1 : 2]]; foreach (p in e.domain()) { // System.out.print("Setting b to e"); printP2(p); b = e[p]; // System.out.print("\nb.domain() = "); printlnRD3(b.domain()); foreach (m in b.domain()) { // System.out.print("b"); printP3(m); // System.out.print(".domain() = "); printlnRD1(b[m].domain()); } } j = new int[R2][3]; foreach (p in j.domain()) { // System.out.print("j"); printP2(p); // System.out.print(".length = "); // System.out.println(j[p].length); } k = new int[3][R2]; for (i = 0; i < 3; i++) { // System.out.print("k["); // System.out.print(i); // System.out.print("]"); // System.out.print(".domain() = "); printlnRD2(k[i].domain()); } System.out.println("ok"); } }