java - Getting an infinite loop while trying to remove from a queue -


I am modeling a fast food drive-in using the Event Objects (yes, homework) priority queue. There are three stations, an order, payment and collection station, each with its own queue. An issue removing an item from the collection station (the last station visit by a customer) when the archive queue is full, the simulation indefinitely starts with the loop and the timer no longer increments. I think this is due to this line:

  Public Zero Process Collection (Customer C, Event E) {collection.remove (c); // This is the same issue which I consider to be a collection. Setserverstats (wrong); However, if I try to use my standard exit () method (which just calls queue.poll () in the station class), then it gives the blank space. . I do not know why this will happen after being added to the queue, this has given me zero problems at any other time, and I have used it on other stations (and I just copy the methods of each station class. Paste, they are all the same) I really appreciate any help on identifying what is the reason for this loop, or, if this (C) is far away, how can I decide this.  

Here is my restaurant class (simulation, lazy I know), but hopefully this is not necessary to see because my document has not yet been completed:

here Specifically the method with which I'm having trouble (collection archive collection that is made from the queue field, remove (customer c) and remove () methods are only for access to queue methods:

  Public Zero ProcessingFoldCollege (Grade Customer C, Event e) {collection.remove (c); / / Customer must be the leader of the queue collection .cserverstats (wrong); // Cashier is not helping anyone if (collection .getQueueSize () & lt ; 2) {// Process of event if available room in collection archive collection Add (payment.remove ()); // Delete customer from payment queue, add to collection cue payment .Setterstrats (wrong); if (! Collection.getServerStatus ()) createFinishCollection (collection.peek ()); // creates events that are processed in the future Land generate new finish paying events for the new head of // payment queue if (payment.getQueueSize () & gt; 0) {double b = this.exponentialPay.next (); // minutes until expired (B == 0.0) {b = this.exponentialPay.next (); // Make sure Return & gt; 0.0} MakeOffinish Payment (B, Payment. P.C.); } // Check that the header of the order line can be moved above (order.getQueueSize ()> 0) {if (order.peek (). GetTimeFinished () == this.clockTime & order. GetServerStatus ()) {ProcessFinishOrder (order.peek ()), eventList.peek ()); } And if (! Order.getServerStatus ()) {Double TimToorder = (order.peek). GetOrderSize () * this.timeToOrderItem); CreateFinishOrder (timeToOrder, order.peek ()); }}}} // and meth processfoodcolon  

If I try to use the Remove () method, I get an exception on an empty indicator:

  Event NewE = New Event (Events.FrenchFoodClick, this.clockTime + (c.getOrderSize () * this.timeToProcessItem), C); From zero customer object (C) to  

it marks back to the createFinishCollection () method call in the above code. So this is how I know that getting me out is empty, but I do not understand that my line says that it is empty when I add it. When someone is removing data structure elements indirectly, do some tricks to see?

I'm calling the way to remove (in the storage space category):

  / ** * Deletes and returns the object in front of the queue * @ Ruran * / Public Customer Removal () {Return Clients Que..poll (); } // Remove the method  

I'm honestly stumped because it will not work. Any guidance will be appreciated (no search for answers, just support).


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -