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

Issue: Lab 08 Fail Test Case: 9_17 #342

Open
aerodromic opened this issue Nov 29, 2022 · 6 comments
Open

Issue: Lab 08 Fail Test Case: 9_17 #342

aerodromic opened this issue Nov 29, 2022 · 6 comments

Comments

@aerodromic
Copy link

Summary

The order of printing the results seems to be off.

Description:

I think it might have something to do with my event comparator? The logic for my comparator first checks if the difference between the events are less than ERR (1E-6), if difference falls within the error (ERR), it checks if the first event has a greater customer number than the second event, if so, it returns 1 else it returns -1. If difference does not fall within the error, it returns Double.compare(first.getTimeStamp(), second.getTimeStamp()). It seems correct to me but I may be mistaken.

Screenshots

image

@kingofburg
Copy link

considering how you passed all other test cases preceding it, I doubt its from your event comparator. I think it might be where you actually "add" the event into PQ.

@Penghao-99
Copy link

Does your event comparator include checks for if event timings happen to be the same? For me, if events happen at the same time, then the event with smaller customer number will be popped from PQ first.

@mohddanesh
Copy link

your eventcomparator seems right to me. maybe it is other issue. does this problem only occur to event about selfcheck

@aerodromic
Copy link
Author

considering how you passed all other test cases preceding it, I doubt its from your event comparator. I think it might be where you actually "add" the event into PQ.

seems to be the case I'll go take a look again

@aerodromic
Copy link
Author

Does your event comparator include checks for if event timings happen to be the same? For me, if events happen at the same time, then the event with smaller customer number will be popped from PQ first.

yup my comparator does check for that

@aerodromic
Copy link
Author

your eventcomparator seems right to me. maybe it is other issue. does this problem only occur to event about selfcheck

Seems to be the case it could be because of the way I make my events wait with an increment of 0.001 if it is waiting at a self checkout counter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants