public class Controller
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
chefIP
The Constant chefIP.
|
static int |
chefPort
The Constant chefPort.
|
static java.lang.String |
waiterIP
The Constant waiterIP.
|
static int |
waiterPort
The Constant waiterPort.
|
Constructor and Description |
---|
Controller(java.net.Socket clientSocket,
Message.DATA_Menu menu,
Message.DATA_Inventory inventory)
Instantiates a new controller.
|
Modifier and Type | Method and Description |
---|---|
void |
addMenu(Message.DATA_MenuItem item)
Adds the menu.
|
boolean |
checkInventory(Message.DATA_TableOrder order)
Check inventory to see if an order can be placed, if it can, then subtract the amounts from the inventory.
|
static void |
main(java.lang.String[] args)
The main method will create the default menu and constantly listen for connections and messages
|
void |
run()
In, the run method, it will take the message that it received and determine what to do with it depending
on the type of message.
|
public static final java.lang.String chefIP
public static final int chefPort
public static final java.lang.String waiterIP
public static final int waiterPort
public Controller(java.net.Socket clientSocket, Message.DATA_Menu menu, Message.DATA_Inventory inventory)
clientSocket
- the client socketmenu
- the menuinventory
- the inventorypublic void addMenu(Message.DATA_MenuItem item)
item
- the itempublic boolean checkInventory(Message.DATA_TableOrder order)
order
- the orderpublic void run()
run
in interface java.lang.Runnable
public static void main(java.lang.String[] args)
args
- the arguments