Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

BusStop

Matthew Pohlmann edited this page Jan 1, 2014 · 1 revision

###Data

List<Passenger> waitingPassengers;
List<Passenger> addList;
Semaphore passengerManagement = new Semaphore(1);

###Messages

public List<Passenger> getPassengerList()
{
	passengerManagement.acquire();
	waitingPassengers.addAll(addList);
	return waitingPassengers;
}

public void addPassenger(Passenger p)
{
	addList.add(p);
}

public void removePassenger(Bus b, List<Passenger> ps)
{
	waitingPassengers.removeAll(ps);
	passengerManagement.release();
}
Clone this wiki locally