public void scheduleEnterRoadMessage(double scheduleTime, Road road) { /* * before entering the new road, we must leave the previous road (if * there is a previous road) the first link does not need to be left * (which has index -1) */ if (this.getLinkIndex() >= 0) { scheduleLeavePreviousRoadMessage(scheduleTime); } if (isEndingLegMode()) { /* * attention: as we are not actually entering the road, we need to * give back the promised space to the road else a precondition of * the enterRequest would not be correct any more (which involves * the noOfCarsPromisedToEnterRoad variable) */ road.giveBackPromisedSpaceToRoad(); // next road scheduleEndLegMessage(scheduleTime, road); } else { _scheduleEnterRoadMessage(scheduleTime, road); } }