Class PentominoBuilder

java.lang.Object
PentominoBuilder

public class PentominoBuilder extends Object
This class contains all the methods that you may need to start developing your project together with the representation of the pentomino's pieces
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static ArrayList<int[][][]>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int[][][]
    eraseDuplicates(int[][][] data)
    Erase duplicates in a array of matrices The input matrix stays unchanged
    static int[][]
    eraseEmptySpace(int[][] data)
    Erase rows and columns that contain only zeros
    static int[][]
    horizontalFlip(int[][] data)
    Flip the matrix horizontally It makes a copy, the input matrix stays unchanged
    static boolean
    isEqual(int[][] data1, int[][] data2)
    Check if two matrices are equal Assume they have the same size
    static boolean
    isEqualRecursion(int[][] data1, int[][] data2, int row, int column)
     
    static void
    main(String[] args)
     
    static int[][]
    makeBigger(int[][] data, int size)
    Expands a smaller than size*size matrix to a size*size matrix It makes a copy, the input matrix stays unchanged Assume that the input is smaller than size!!
    static void
    Make the database, created based on the pentomino's pieces defined in basicDatabase
    static int[][]
    moveToAbove(int[][] data)
    Move matrix to the left above corner Does not make a copy!
    static int[][]
    rotate(int[][] data, int rotation)
    Rotate the matrix x times over 90 degrees Assume that the matrix is a square! It does not make a copy, so the return matrix does not have to be used
    static int[][]
    verticalFlip(int[][] data)
    Flip the matrix vertically It makes a copy, the input matrix stays unchanged

    Methods inherited from class java.lang.Object

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

    • database

      public static ArrayList<int[][][]> database
  • Constructor Details

    • PentominoBuilder

      public PentominoBuilder()
  • Method Details

    • makeDatabase

      public static void makeDatabase()
      Make the database, created based on the pentomino's pieces defined in basicDatabase
    • rotate

      public static int[][] rotate(int[][] data, int rotation)
      Rotate the matrix x times over 90 degrees Assume that the matrix is a square! It does not make a copy, so the return matrix does not have to be used
      Parameters:
      data - : a matrix
      rotation - : amount of rotation
      Returns:
      the rotated matrix
    • verticalFlip

      public static int[][] verticalFlip(int[][] data)
      Flip the matrix vertically It makes a copy, the input matrix stays unchanged
      Parameters:
      data - : a matrix
      Returns:
      the flipped matrix
    • horizontalFlip

      public static int[][] horizontalFlip(int[][] data)
      Flip the matrix horizontally It makes a copy, the input matrix stays unchanged
      Parameters:
      data - a matrix
      Returns:
      the flipped matrix
    • makeBigger

      public static int[][] makeBigger(int[][] data, int size)
      Expands a smaller than size*size matrix to a size*size matrix It makes a copy, the input matrix stays unchanged Assume that the input is smaller than size!!
      Parameters:
      data - : a matrix
      size - : the square size of the new matrix
      Returns:
      the size*size matrix
    • moveToAbove

      public static int[][] moveToAbove(int[][] data)
      Move matrix to the left above corner Does not make a copy!
      Parameters:
      data - : a matrix
      Returns:
      the modified matrix
    • eraseDuplicates

      public static int[][][] eraseDuplicates(int[][][] data)
      Erase duplicates in a array of matrices The input matrix stays unchanged
      Parameters:
      data - an array of matrices
      Returns:
      the array of matrices without duplicates
    • isEqual

      public static boolean isEqual(int[][] data1, int[][] data2)
      Check if two matrices are equal Assume they have the same size
      Parameters:
      data1 - : the first matrix
      data2 - : the second matrix
      Returns:
      true if equal, false otherwise
    • isEqualRecursion

      public static boolean isEqualRecursion(int[][] data1, int[][] data2, int row, int column)
    • eraseEmptySpace

      public static int[][] eraseEmptySpace(int[][] data)
      Erase rows and columns that contain only zeros
      Parameters:
      data - a matrix
      Returns:
      the shrinken matrix
    • main

      public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException
      Parameters:
      args -
      Throws:
      FileNotFoundException
      UnsupportedEncodingException