/**
  * Returns the next ItemToShip that needs to be processed. Removes the item from the ShipmentQueue
  * and adds it to the ShipmentProcessStation.
  *
  * @return ItemToShip item to be processed next.
  */
 public ItemToShip processNext() {
   if (queueFromFactory == null) {
     throw new NoSuchElementException();
   }
   ItemToShip item = queueFromFactory.remove();
   item.getInLine(station);
   return item;
 }
 /**
  * Tells when the item at the front of the ConveyorBelt queue will depart that queue and
  * subsequently enter a ShipmentProcessStation queue. If the queue is empty, return
  * Integer.MAX_VALUE.
  *
  * @return int departTime time when the item at the front of the conveyor belt will depart.
  */
 public int departTimeNext() {
   int departTime = Integer.MAX_VALUE;
   if (!queueFromFactory.isEmpty()) {
     ItemToShip item = queueFromFactory.front();
     departTime = item.getArrivalTime();
   }
   return departTime;
 }
Beispiel #3
0
 /**
  * Updates the three data members from the parameter. Checks that the ItemToShip is not null.
  *
  * @param item ItemToShip package
  */
 public void logItem(ItemToShip item) {
   // Make sure that ItemToShip is not null
   if (item != null) {
     // ItemToShip is used to record the item's statistics
     numCompleted++;
     totalWaitTime += item.getWaitTime();
     totalProcessTime += item.getProcessTime();
   }
 }