Harish Shivaraj wrote:I know what i want...
Harish Shivaraj wrote:I have an interface called events which some basic method. And the class which implement that event say printevent, printstatus etc should implement comparable interface. whats the elegant way of doing this?
Clearly i cant enforce this from the interface level. Therefore I was wondering how would go on about doing this?
Harish Shivaraj wrote:If that makes sense?
Harish Shivaraj wrote:Anyone find anything stupid ive done here?
Harish Shivaraj wrote:The type Event cannot extends on implement Comparable<? extends Event>. A supertype may not specify any wildcard.
Harish Shivaraj wrote:Guys I really appreciate your help so far. Im sort of stuck, I understand your approach but however this is what ive got and i need this working. But im not able to get it working.
I need queue of Jobs, so that I can insert any subtype of Jobs class. Like PrintJob or Print status etc.
Ive been banging my head on this. Can you please shred some light.
Junilu Lacar wrote:The holiday season tends to stress me out a little and I think I may be running a little low on the spirit...
And I apologize if I seemed a bit curt in my previous response. The holiday season tends to stress me out a little and I think I may be running a little low on the spirit... listen to Winston, he's got a much more level head than I do right now
Well, shredding light is beyond even my capabilities , but the reason you're having the problem is that Jobs doesn't implement
Comparable<"something extended from Jobs">
and the compiler is quite finicky about these distinctions.
And if you think about it, it's absolutely right to complain. If you want a collection that can contain a mixture of Jobs subclasses, then they MUST be mutually comparable; otherwise you'll run into problems whenever you try to compare a PrintJob with a PrintStatus.
Harish Shivaraj wrote:This is an assignment which im working on toward my degree which is due for submission next Tuesday, I really don’t have much time at all do i?
Basically the simulator has two queues one general queue where all the jobs/event which is prioritized according to time and there's another queue which gets prioritized by the actual priority. The entire system is a event based. It Just goes around the loop picking jobs of the queue. This is what im trying to achieve.