/**
 *
 * @author Ryan J. Marcotte
 */

package manager;

import java.util.LinkedList;
import java.util.Queue;

import robot.Command;
import robot.Motion;

public class RobotState
{
    private boolean ready;
    private Queue<Command> commandQueue;
    private Queue<Motion> motionQueue;
    
    public RobotState()
    {
        commandQueue = new LinkedList<>();
        motionQueue = new LinkedList<>();
    }

    public synchronized void addNewCommand(Command newCommand)
    {
        commandQueue.offer(newCommand);
    }

    public synchronized void addNewMotion(Motion newMotion)
    {
        motionQueue.offer(newMotion);
    }

    public synchronized boolean isCommandAvailable()
    {
        return !commandQueue.isEmpty();
    }

    public synchronized boolean isMotionAvailable()
    {
        return !motionQueue.isEmpty();
    }

    public synchronized boolean isReady()
    {
        return ready;
    }

    public synchronized Command removeNextCommand()
    {
        return commandQueue.poll();
    }

    public synchronized Motion removeNextMotion()
    {
        return motionQueue.poll();
    }

    public synchronized void setReady(boolean ready)
    {
        this.ready = ready;
    }
}

@@ -286,13 +286,70 @@
 ue;%0A
+    private int boardRows;%0A    private int boardColumns;%0A
     %0A
-
     
@@ -685,32 +685,202 @@
 Motion);%0A    %7D%0A%0A
+    public synchronized int getBoardColumns()%0A    %7B%0A        return boardColumns;%0A    %7D%0A%0A    public synchronized int getBoardRows()%0A    %7B%0A        return boardRows;%0A    %7D%0A%0A
     public synch
@@ -1400,32 +1400,32 @@
 an ready)%0A    %7B%0A
-
         this.rea
@@ -1441,11 +1441,235 @@
 y;%0A    %7D
+%0A%0A    public synchronized void setBoardColumns(int boardColumns)%0A    %7B%0A        this.boardColumns = boardColumns;%0A    %7D%0A%0A    public synchronized void setBoardRows(int boardRows)%0A    %7B%0A        this.boardRows = boardRows;%0A    %7D
 %0A%7D%0A

add board rows and columns to the robot state