public Elevator(int id, Floor highestFloor, Floor lowestFloor) { _upDirectionQueue = new FloorRequestQueue(ascending); _downDirectionQueue = new FloorRequestQueue(descending); _stop = true; DirectionOfTravel = Direction.Up; CurrentFloor = lowestFloor; HighestFloor = highestFloor; Id = id; LowestFloor = lowestFloor; _status = Status.Idle; }
private IEnumerable <FloorRequest> FloorsBelowCurrent(FloorRequestQueue queue) { return(queue.Any ? queue.Where(f => f.Floor <= CurrentFloor) : null); }