public void Operate(EnumElevatorDirection direction) { _direction = direction; switch (_direction) { case EnumElevatorDirection.Up: if (_upQueue.Contains(_currentFloor)) { _upQueue.Remove(_currentFloor); _status = EnumElevatorStatus.Stopped; } else { _status = EnumElevatorStatus.Moving; } break; case EnumElevatorDirection.Down: if (_downQueue.Contains(_currentFloor)) { _downQueue.Remove(_currentFloor); _status = EnumElevatorStatus.Stopped; } else { _status = EnumElevatorStatus.Moving; } break; case EnumElevatorDirection.Idle: _status = EnumElevatorStatus.Idle; break; } }
public void MoveUp() { if (this._currentFloor < _maxFloor) { this._currentFloor += 1; _status = EnumElevatorStatus.MovingUp; } else { _status = EnumElevatorStatus.LastFloor; } }
public void MoveDown() { if (_currentFloor > _minFloor) { this._currentFloor -= 1; _status = EnumElevatorStatus.MovingDown; } else { _status = EnumElevatorStatus.GroundFloor; } }