Name: Anonymous 2012-01-01 0:10
ENTERPRISE SOLUTIONS FOR A BETTER /PROG/
/*
* Import util.* for List and ArrayList
*/
import java.util.*;
public final class IntegerThreeDimensionalMapFactory
{
/*
* Function : makeMap
* Arguments: int xCoordinate -> The number of values in the X dimension
* : int yCoordinate -> The number of values in the Y dimension
* : int zCoordinate -> The number of values in the Z dimension
* : int initialValue -> The initial value of each point
* Returns : List<List<List<Integer>>> -> The initialized 3 dimensional map
*/
public static final List<List<List<Integer>>> makeNewThreeDimensionalIntegerMap(final int xCoordinate,
final int yCoordinate,
final int zCoordinate,
final int initialValue){
// Create our 3 Dimensional List with size xCoordinate
List<List<List<Integer>>> ThreeDimensionalIntegerMap = new ArrayList<ArrayList<ArrayList<Integer>>>(xCoordinate);
// Initilize the X,Y,Z Dimensions
for(int i = 0;i < xCoordinate; i++){
// Create an inner 2 Dimensional List with size yCoordinate
List<List<Integer>> TwoDimensionalIntegerMap = new ArrayList<ArrayList<Integer>>(yCoordinate);
for(int j = 0;j < yCoordinate; j++){
// Create an inner inner 1 Diemnsional List with size zCoordinate
List<Integer> OneDimensionalIntegerMap = new ArrayList<Integer>(zCoordinate);
for(int o = 0;o < zCoordinate; o++){
// Initilized an Integer to 0
Integer singleDimensionalPoint = new Integer(0);
// Add the Integer to the 1D List
OneDimensionalIntegerMap.add(singleDimensionalPoint);
}
// Add the 1D List to the 2D List
TwoDimensionalIntegerMap.add(OneDimensionalIntegerMap);
}
// Add the 2D List to the 3D List
ThreeDimensionalIntegerMap.add(TwoDimensionalIntegerMap);
}
// Return the 3D List
return(ThreeDimensionalIntegerMap);
} //End of makeNewThreeDimensionalIntegerMap method
} // End Of File