Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 10th, 2004, 11:35 PM
Registered User
Join Date: May 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code in Java for priority queue

   I have to create one interface named IPriorityQ which contain the priorityQ. And the priorityQ must be able to check if the queue is empty, if it is full, add a queue, remove from queue and the number of size that returns the number of a element left in a queue.
  Also I have to create a class called PriorityQ that implements tbe Interface IPriorityQ. The priority quere here is to be implemented with an array of 3 circular queues - one fore each level of prioirty . this arrays has to be instance variable in this class. An empty circular queue is to be created and put at each element of the array. I have to include get and set methods also. I have 3 priority 1,2,and 3 and I have to sort in descending order as priority 3 should be in the top. Can u please give me some idea about the code. I have to do this on java

Reply With Quote
  #2 (permalink)  
Old May 13th, 2004, 06:51 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

This sounds like a homework assignment. If it is, you should probably ask your instructor, teacher's assistant, homework tutor, etc... for help. You can also research priority queues online and look for tutorials.

The interface class is easy:

public interface IPriorityQueue
    bool isEmpty();
    bool isFull();

    void push(Object o); // add to queue
    Object pop(); // remove from queue

    int size();

Then you'll need to define your class and implement the above functions:

public class PriorityQueue implements IPriorityQueue
    // interface functions are implemented here

I can't guarantee that all my syntax is correct, it's been a while since I've used java. C++ uses abstract base classes with pure virtual functions to achieve creating an "interface" class.

Take care,

Reply With Quote
  #3 (permalink)  
Old May 15th, 2004, 05:28 AM
Registered User
Join Date: May 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

ty for the answer but the question i was confusing was another one like in an office they got level 1,2 and 3 and in level 1 there are many people working and the people have their name address position etc. and now I have to store this level 1,2 and 3 in array in such a way that when I search for array 1 then it will show me all the details of the people working in level 1. When I do array 2 then it should give me all the people working in level 2. Can u give me idea how can I do this. I will be very thankful for your help

Reply With Quote
  #4 (permalink)  
Old November 13th, 2004, 08:08 PM
Registered User
Join Date: Nov 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

hi, ive also got a question abt priority queue. can i use it to implement a task scheduler? basically, the sheduler has to return a task with the earliest time stamp and the task aren't ordered. will it be the best data structure to use to implement it? thanks
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Code - Wrox - Beginning JAVA - Ivor Horton ponguru Java Databases 3 May 18th, 2006 12:30 PM
bugbase: priority display in addedit is always 3 Far BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 April 25th, 2006 01:29 PM
Set base priority of exe lmadhavi Visual C++ 0 September 6th, 2004 05:00 AM

All times are GMT -4. The time now is 12:56 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.