⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customer.java

📁 Barber Shop algorithm Synchronization Simulator
💻 JAVA
字号:
/*  Customer.java
 *
 *  The Customer Thread's main activities are call the methods in Barbershop class.
 *
 *
 *  @author: 	   Jie Zhang
 *  Last Updated: 07/19/2002
 */

public class Customer extends Thread{

	private BarberShopApplet tapplet;
	private BarberShop shop;
	private int cid;
	int delay 		= 2500;
	int status		= 0;
	int cutFinish 	= 0;
	int barberID 	= 0;
	int paid 		= 0;

	public Customer(BarberShopApplet applet, BarberShop iq, int id){
		shop	 = iq;
		tapplet  = applet;
		cid 	 = id;
	}

	public void run(){

		 try{

			  status = 0;
			  tapplet.mc.println(status, "c", cid);

			  shop.sitSofa(tapplet, cid);
			  sleep(delay);
			  shop.sitBarberChair(tapplet, cid);
			  shop.waitPay(tapplet, cid);

			} catch(InterruptedException e){
				System.err.println("Customer Exception " +  e.toString());
			}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -