Class Table


  • public class Table
    extends Block
    A table in the blocks-world. In contrast to a block, a table may have multiple blocks on top.
    • Field Detail

      • name

        protected java.lang.String name
        The name of the table.
      • blocks

        protected java.util.List blocks
        The blocks located on top of the table.
    • Constructor Detail

      • Table

        public Table()
        Create a new table.
      • Table

        public Table​(java.lang.String name,
                     java.awt.Color color)
        Create a new table.
        Parameters:
        name - The name of the table.
        color - The color of the table.
    • Method Detail

      • isClear

        public boolean isClear()
        The table is always clear.
        Overrides:
        isClear in class Block
      • toString

        public java.lang.String toString()
        Create a string representation of this block.
        Overrides:
        toString in class Block
      • getAllBlocks

        public Block[] getAllBlocks()
        Get all blocks on the table. Also returns blocks which are located on other blocks on the table.
      • getStacks

        public Block[][] getStacks()
        Get the stacks on the table.
      • clear

        public void clear()
        clear all blocks from the table.
      • configurationEquals

        public boolean configurationEquals​(Table table)
        Check if two configurations are equal.
      • addBlock

        protected void addBlock​(Block block)
        Add a block to this block.
        Overrides:
        addBlock in class Block
      • removeBlock

        protected void removeBlock​(Block block)
        Remove a block from this block.
        Overrides:
        removeBlock in class Block