I am converting a Javascript program that I wrote in Java, and there is one object there that I am not sure how to write in Java.
tetros.types = new Array();
tetros.types[0] = new Object();
tetros.types[0].color = "green";
tetros.types[0].rotations = new Array();
tetros.types[0].rotations[0] = new Object();
tetros.types[0].rotations[0].blocks = Array([0,0],[1,0],[2,0],[2,1]);
tetros.types[0].rotations[0].edges ={
"down" :Array([2,0],[2,1]),
"left" :Array([0,0],[1,0],[2,0]),
"right" :Array([2,1],[1,0],[0,0]),
"up" :Array([0,0],[2,1])
}
tetros.types[0].rotations[1] = new Object();
tetros.types[0].rotations[1].blocks = Array([0,0],[0,1],[0,2],[1,0]);
tetros.types[0].rotations[1].edges ={
"down" :Array([0,1],[0,2],[1,0]),
"left" :Array([0,0],[1,0]),
"right" :Array([0,2],[1,0]),
"up" :Array([0,0],[1,0])
}
tetros.types[0].rotations[2] = new Object();
tetros.types[0].rotations[2].blocks = Array([0,0],[0,1],[1,1],[2,1]);
tetros.types[0].rotations[2].edges ={
"down" :Array([0,0],[2,1]),
"left" :Array([0,0],[1,1],[2,1]),
"right" :Array([0,1],[1,1],[2,1]),
"up" :Array([0,0],[0,1])
}
tetros.types[0].rotations[3] = new Object();
tetros.types[0].rotations[3].blocks = Array([0,2],[1,0],[1,1],[1,2]);
tetros.types[0].rotations[3].edges ={
"down" :Array([1,0],[1,1],[1,2]),
"left" :Array([1,0],[0,2]),
"right" :Array([0,2],[1,2]),
"up" :Array([0,2],[1,0],[1,1])
}
tetros.types[1] = new Object();
tetros.types[1].color = "blue";
tetros.types[1].rotations = new Array();
tetros.types[1].rotations[0] = new Object();
tetros.types[1].rotations[0].blocks = Array([0,0],[0,1],[1,0],[1,1]);
tetros.types[1].rotations[0].edges ={
"down" :Array([1,0],[1,1]),
"left" :Array([0,0],[1,0]),
"right" :Array([0,1],[1,1]),
"up" :Array([0,0],[0,1])
}
tetros.types[1].rotations[1] = new Object();
tetros.types[1].rotations[1].blocks = tetros.types[1].rotations[0].blocks;
tetros.types[1].rotations[1].edges = tetros.types[1].rotations[0].edges;
tetros.types[1].rotations[2] = new Object();
tetros.types[1].rotations[2].blocks = tetros.types[1].rotations[0].blocks;
tetros.types[1].rotations[2].edges = tetros.types[1].rotations[0].edges;
tetros.types[1].rotations[3] = new Object();
tetros.types[1].rotations[3].blocks = tetros.types[1].rotations[0].blocks;
tetros.types[1].rotations[3].edges = tetros.types[1].rotations[0].edges;
This is about 1/4 of the whole object, but everything else is something more.
How can I write this in Java?