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 class
GreedyAlgorithm.RatioSorter
(package private) static class
GreedyAlgorithm.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 ParcelType
typeA
(package private) static ParcelType
typeB
(package private) static ParcelType
typeC
(package private) static double[]
volumes
-
Constructor Summary
Constructors Constructor Description GreedyAlgorithm()
-
Method Summary
Modifier and Type Method Description static void
addSolid(int[][][] solid, int[] coord, int color, int[] indexes)
Method adding a solid to the container (field) at the specified coordinatesstatic boolean
checkParcel(int[][][] solid, int[] coord)
static void
emptyContainer()
Method that removes all objects from the container, equivalent to creating a new container objectsstatic int[][][]
fetchArray(int p, int r)
static void
fillContainer()
static void
printInfo()
Method printing the amount of each parcel type used and the final score (value)static void
runAlgorithm()
-
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)
-