|
public void act()
{
//ADDED ENTIRE ACT FUNCTIONALITY
if(destinations.isEmpty() == true && pickups.isEmpty() == true)
{
incrementIdleCount();
}
else
{
chooseTargetLocation();
Location target = getTargetLocation();
if(target != null) {
// Find where to move to next.
Location next = getLocation().nextLocation(target);
setLocation(next);
if(next.equals(target))
{
if(target == pickups.get(0))
{
notifyPickupArrival();
}
else if(target == destinations.get(0))
{
System.out.println(passengers.get(0));
notifyPassengerArrival(passengers.get(0));
offloadPassenger();
}
}
}
}
}
this is the method my problem appears in, The result of my println is "Passenger travelling from location 2,28 to location 18,21", in accordance with the toString method of the passenger class.
|