private void ServiceFloorRequestInUpwardDirection() { FloorRequest nextRequestAbove = GetNextRequestAbove(); if (null == nextRequestAbove) { return; } if (nextRequestAbove.Floor != CurrentFloor) { Ascend(); return; } if (nextRequestAbove.Direction != Direction.Down) { Floor stopFloor = nextRequestAbove.Floor; _upDirectionQueue.Remove(nextRequestAbove); StopAtFloor(stopFloor); } if (ShouldReverseDirections()) { ReverseDirectionOfTravel(); } }
private void ServiceFloorRequestsInDownwardDirection() { FloorRequest nextRequestBelow = GetNextRequestBelow(); if (null == nextRequestBelow) { return; } if (nextRequestBelow.Floor != CurrentFloor) { Descend(); return; } if (nextRequestBelow.Direction != Direction.Up) { Floor stopFloor = nextRequestBelow.Floor; _downDirectionQueue.Remove(nextRequestBelow); StopAtFloor(stopFloor); } if (ShouldReverseDirections()) { ReverseDirectionOfTravel(); } }