Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 2 level 5 #558

Open
Shandon96 opened this issue Nov 29, 2020 · 3 comments
Open

Project 2 level 5 #558

Shandon96 opened this issue Nov 29, 2020 · 3 comments
Labels
🖱️ Java General Questions with regards to Java or its API

Comments

@Shandon96
Copy link

Shandon96 commented Nov 29, 2020

Description

Hi guys, I am having issues with project 2 level 5, in that my server does not seem to be updated correctly (1st pic). In my Simulator queue, I check if the server in the current updated shop is available being going ahead with ServeEvent (2nd pic). In my ServeEvent class, I check if it came from ArriveEvent, and add one to the queueLength if that is so, or else I leave the queueLength as it is (3rd pic). I have spent many days on this level and still can't figure out the problem, so I will greatly appreciate any help!
image
image
image

Topic:

Specific Topics this question is related to (If Any)

Screenshots (if any):

@Shandon96 Shandon96 added the 🖱️ Java General Questions with regards to Java or its API label Nov 29, 2020
@chuashiqi
Copy link

chuashiqi commented Nov 29, 2020

in your ServeEvent, you'll need to get the updated Server from the shop by using shop.find()

@goatygoatygoat
Copy link

I think it would be better if you handled the checking of availability of server in ServeEvent instead, as your event classes can only have one method (the toString() method) as specified by the project requirement. For the function in the ServeEvent constructor, check if the server is available using shop.find(x -> x.getIdentifier() == server.getIdentifier()).get().isAvailable(). If it is available, then proceed to return a pair of updated shop and DoneEvent. If it is not available, return a pair of the shop and a new ServeEvent with the updated time when the server is next available. Hope this helps!

@Shandon96
Copy link
Author

Thanks @shhiiiqqqqiiiii and @goatygoatygoat! I've finally solved it after so many excruciating days! Hope the rest of the project will be doable for me. All the best for your finals tmr! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖱️ Java General Questions with regards to Java or its API
Projects
None yet
Development

No branches or pull requests

3 participants