Example #1
0
 /// <summary>
 /// Class constructor.
 /// Here we instantiate all of our class variables.
 /// </summary>
 /// <param name="allFloors">Our constructor takes a "List<Floor>" object in order to compare the data inside this class with the variable.</param>
 /// <param name="numOfFloors">An integer which can be used to controll the number of floors./param>
 public Elevator(List <Floor> allFloors, int numOfFloors = 10)
 {
     arrivedPassengers      = new List <Person>();
     totalWaitingTime       = 0;
     totalCompletionTime    = 0;
     peopleWithShortestTime = 0;
     peopleWithLongestTime  = 0;
     currentDirection       = Direction.DirectionEnum.Up;
     currentPeople          = new List <Person>(10);
     listOfFloors           = allFloors;
     elevatorRuntime        = 0;
     _currentFloor          = 0;
 }
Example #2
0
 /// <summary>
 /// Moves our elevator up or down depending on what the current direction and current floor variables are currently set to.
 /// It also increases or decreases our _currentFloor variable and increases our elevator runtime.
 /// </summary>
 /// <param name="currentDirection"></param>
 public void MoveElevator(Direction.DirectionEnum currentDirection)
 {
     if (currentDirection == Direction.DirectionEnum.Up && _currentFloor < 9)
     {
         _currentFloor   += 1;
         elevatorRuntime += 10;
     }
     else if (currentDirection == Direction.DirectionEnum.Down && _currentFloor > 0)
     {
         _currentFloor   -= 1;
         elevatorRuntime += 10;
     }
 }
Example #3
0
 public void SetCurrentDirection(Direction.DirectionEnum currDirr)
 {
     currentDirection = currDirr;
 }