Class Cell

  • All Implemented Interfaces:
    Cloneable

    public class Cell
    extends Object
    implements Cloneable
    Class that is used to store a single board cell information
    • Constructor Detail

      • Cell

        public Cell()
        Create an instance of Cell with no blocks
      • Cell

        public Cell​(List<Block> blocks)
        Create an instance of Cell with specified blocks
        Parameters:
        blocks - blocks to put in this Cell
    • Method Detail

      • addBlock

        public void addBlock​(Block blockToAdd)
        Add a block on top of the stack
        Parameters:
        blockToAdd - block to add
      • popBlock

        public Block popBlock()
        Remove and Return the top block of the stack, null in case there is nothing
        Returns:
        top block on the stack
      • getBlock

        public Block getBlock()
        Get the top block of the stack
        Returns:
        Top block of the stack
      • getBlock

        public Block getBlock​(int i)
        Get a specific block of the stack
        Parameters:
        i - position of the block on the stack
        Returns:
        block selected, in case i is invalid, it is returned the closest block
      • getSize

        public int getSize()
        Get the number of blocks in the Cell
        Returns:
        number of blocks in the Cell