How do i sort a priority queue by the priority ???
sort priority queue ?
Page 1 of 13 Replies - 9437 Views - Last Post: 02 April 2009 - 02:29 PM
Replies To: sort priority queue ?
#2
Re: sort priority queue ?
Posted 02 April 2009 - 01:39 PM
Like what are talking about priority queue? like the system queue? or a queue you have set up?
#3
Re: sort priority queue ?
Posted 02 April 2009 - 01:49 PM
i have 4 classes and a tester
-Task
(String taskDescription, String taskCategory, int taskUrgency, String taskDay, String taskMonth, int taskYear)
This class implements Comparable and has the following methods
get() and sets()
compareTo()
toString()
- ArrayStack
This class has the following methods
push()
pop()
peek()
isEmpty()
isFull()
toString()
length()
-PriorityQueue
This class has these methods
insert()
remove()
peek()
isEmpty()
isFull()
toString()
length()
Then the tester creates an array stack and fills it with tasks. it then searches for tasks to be completed today and is meant to be inserted into the priority queue. The most urgent task is then meant to be displayed and the priority queue is to be sorted by urgency.
-Task
(String taskDescription, String taskCategory, int taskUrgency, String taskDay, String taskMonth, int taskYear)
This class implements Comparable and has the following methods
get() and sets()
compareTo()
toString()
- ArrayStack
This class has the following methods
push()
pop()
peek()
isEmpty()
isFull()
toString()
length()
-PriorityQueue
This class has these methods
insert()
remove()
peek()
isEmpty()
isFull()
toString()
length()
Then the tester creates an array stack and fills it with tasks. it then searches for tasks to be completed today and is meant to be inserted into the priority queue. The most urgent task is then meant to be displayed and the priority queue is to be sorted by urgency.
#4
Re: sort priority queue ?
Posted 02 April 2009 - 02:29 PM
Your PriorityQueue class needs to implement the Comparable interface: Comparable
Note Java has a PriorityQueue class: PriorityQueue
Note Java has a PriorityQueue class: PriorityQueue
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|