private void TryToShipOrder(IncomingOrder incomingOrder, Map<String, Integer> inventoryList)
	{
		boolean partialOrder = false;
		print("the market is now trying to ship the order");
		Map<String, Integer> groceryList = incomingOrder.incomingList;
		Map<String, Integer> outgoingList = groceryList;
		synchronized(groceryList)
		{
		for (Map.Entry<String, Integer> groceryItem : groceryList.entrySet())
		{
			synchronized(inventoryList)
			{
			for (Map.Entry<String, Integer> marketItem : inventoryList.entrySet())
			{
				if (groceryItem.getKey().equals(marketItem.getKey())) //if the two comparing items are the same
				{	
					if (marketItem.getValue()>=groceryItem.getValue())//if the inventory has enough supplies for the order
					{
						marketItem.setValue(marketItem.getValue()-groceryItem.getValue());
						outgoingList.put(groceryItem.getKey(), groceryItem.getValue());
					}
					else if (marketItem.getValue()>0) //inventory has some supplies but not enough
					{
						partialOrder=true;
						outgoingList.put(groceryItem.getKey(), marketItem.getValue()); //take all the market's supplies
						marketItem.setValue(0);
					}
					else if (marketItem.getValue()==0)
					{
						outgoingList.put(groceryItem.getKey(), 0);
					}
				}	
			}
			}
		}
		}
		print("the market is shipping the food to the cook");
		if(partialOrder)
		{
			try
			{
				Thread.sleep(5000);
			}
			catch(Exception e)
			{
				System.out.println("Exception caught");
			}
			incomingOrder.state= reStockingState.failedToFufillOrder;
			cashier.msgHereIsMarketBill(this, CalculateBill(outgoingList), outgoingList);
			incomingOrder.cook.msgFufilledPartialOrder(name, outgoingList);
		}
		else
		{
			try
			{
				Thread.sleep(5000);
			}
			catch(Exception e)
			{
				System.out.println("Exception caught");
			}
			incomingOrder.state= reStockingState.fufillingOrder;
			cashier.msgHereIsMarketBill(this, CalculateBill(outgoingList), outgoingList);
			incomingOrder.cook.msgFufilledCompleteOrder(name, outgoingList);			
		}
	}