Package Phase3
Class GreedyAlgorithm
java.lang.Object
Phase3.GreedyAlgorithm
public class GreedyAlgorithm
extends java.lang.Object
The class holding all of the methods of the greedy algorithm
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classGreedyAlgorithm.RatioSorter(package private) static classGreedyAlgorithm.ValueSorter -
Field Summary
Fields Modifier and Type Field Description (package private) static int[][][][]parcelARotations(package private) static int[][][][]parcelBRotations(package private) static int[][][][]parcelCRotations(package private) static java.util.ArrayList<ParcelType>parcelTypes(package private) static ParcelTypetypeA(package private) static ParcelTypetypeB(package private) static ParcelTypetypeC(package private) static double[]volumes -
Constructor Summary
Constructors Constructor Description GreedyAlgorithm() -
Method Summary
Modifier and Type Method Description static voidaddSolid(int[][][] solid, int[] coord, int color, int[] indexes)Method adding a solid to the container (field) at the specified coordinatesstatic booleancheckParcel(int[][][] solid, int[] coord)static voidemptyContainer()Method that removes all objects from the container, equivalent to creating a new container objectsstatic int[][][]fetchArray(int p, int r)static voidfillContainer()static voidprintInfo()Method printing the amount of each parcel type used and the final score (value)static voidrunAlgorithm()
-
Field Details
-
typeA
-
typeB
-
typeC
-
parcelTypes
-
volumes
static double[] volumes -
parcelARotations
static int[][][][] parcelARotations -
parcelBRotations
static int[][][][] parcelBRotations -
parcelCRotations
static int[][][][] parcelCRotations
-
-
Constructor Details
-
GreedyAlgorithm
public GreedyAlgorithm()
-
-
Method Details
-
runAlgorithm
public static void runAlgorithm() -
fillContainer
public static void fillContainer() -
checkParcel
public static boolean checkParcel(int[][][] solid, int[] coord) -
addSolid
public static void addSolid(int[][][] solid, int[] coord, int color, int[] indexes)Method adding a solid to the container (field) at the specified coordinates- Parameters:
solid- : solid to be addedcoord- : coordinates to add the solid atcolor- : color of the parcel that is being addedindexes- : array storing the piece ID and rotation ID
-
fetchArray
public static int[][][] fetchArray(int p, int r) -
emptyContainer
public static void emptyContainer()Method that removes all objects from the container, equivalent to creating a new container objects -
printInfo
public static void printInfo()Method printing the amount of each parcel type used and the final score (value)
-