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 coordinates
    static boolean checkParcel​(int[][][] solid, int[] coord)  
    static void emptyContainer()
    Method that removes all objects from the container, equivalent to creating a new container objects
    static 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()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • 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 added
      coord - : coordinates to add the solid at
      color - : color of the parcel that is being added
      indexes - : 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)