Hrmmmm.... I'll try to explain better this time. First off, here is an overview of all my classes:
Master - can't change the code here, but it puts things into a task bag, and gets things out of a result bag, so there are two seperate objects(task and result) of the same type.
Worker - This takes the two Bags as parameters, plus an int as a reference for which thread it is. So I have two bags called task and result. It also contains the run method I put up above.
Task - Takes in some parameters and does the operations on them, just has a constructor and works perfectly well.
Answer - Just like the Task, just stores some information, works fine.
Bag - 2 parameters, boolean variable called available and the Object to store. Has the get and put methods mentioned above, plus the done() method is suppose to be here but I have no idea what it's suppose to do, and not really worried with it at this moment.
The master thread creates the threads, puts the tasks into worker objects, and then starts the Worker(worker.start()). The Master then puts the task into the task bag, and then it gets the results from the result bag.
The run() method in the worker class is supposed to be doing the following: it goes into the task bag and gets the value stored in the object in the bag(which is of type Task). It then creates an Answer object, and stores the value into that object. Then it's supposed to put the Answer object into a results bag(different than the task bag). So I have 2 bags, result and task. I hope this makes
alot more sense. I posted all the code above that really mattered, since 2 classes are nothign but containers, and I can't change one.
[ October 08, 2004: Message edited by: Billy Boob ]