org.objectweb.proactive.branchnbound.core.queue
Class LargerQueueImpl

java.lang.Object
  extended byorg.objectweb.proactive.branchnbound.core.queue.TaskQueue
      extended byorg.objectweb.proactive.branchnbound.core.queue.LargerQueueImpl
All Implemented Interfaces:
java.io.Serializable

public class LargerQueueImpl
extends TaskQueue

This queue provides tasks in a Breath First Search order.

Author:
Alexandre di Costanzo Created on Nov 3, 2005
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.proactive.branchnbound.core.queue.TaskQueue
logger
 
Constructor Summary
LargerQueueImpl()
          The no args constructor for ProActive activate.
 
Method Summary
 void addAll(java.util.Collection tasks)
          Adding a set of tasks in the queue.
 void addResult(Result result)
          Add a found result for the final gather.
 void addTask(Task t)
          Add a task for computing in the queue.
 void backupResults(java.io.OutputStream backupOutputStream)
          Backuping in a stream all current found results.
 void backupTasks(Task rootTask, java.util.Vector pendingTasks, java.io.OutputStream backupOutputStream)
          Write all tasks for backuping.
 void flushAll()
          Empty the queue for a new computation.
 java.util.Collection getAllResults()
           
 Task getRootTaskFromBackup()
          Restore the root task.
 BooleanMutableWrapper hasNext()
           
 IntMutableWrapper howManyResults()
           
 BooleanWrapper isHungry()
           
 void loadResults(java.io.InputStream backupResultInputStream)
          Restoring results from a backup.
 void loadTasks(java.io.InputStream taskInputStream)
          Restoring all tasks from a previous backup.
 Task next()
          Return the next task to be computed, and remove it from the queue.
 void setHungryLevel(int level)
          Set the hungry level for this queue.
 IntMutableWrapper size()
           
 
Methods inherited from class org.objectweb.proactive.branchnbound.core.queue.TaskQueue
getBestCurrentResult, informNewBestResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LargerQueueImpl

public LargerQueueImpl()
The no args constructor for ProActive activate.

Method Detail

addAll

public void addAll(java.util.Collection tasks)
Description copied from class: TaskQueue
Adding a set of tasks in the queue. Usually a set of sub-tasks from a task which is computing.

Specified by:
addAll in class TaskQueue
Parameters:
tasks - a Collection of Task classes.
See Also:
TaskQueue.addAll(java.util.Collection)

size

public IntMutableWrapper size()
Specified by:
size in class TaskQueue
Returns:
the number of tasks not yet computed.
See Also:
TaskQueue.size()

hasNext

public BooleanMutableWrapper hasNext()
Specified by:
hasNext in class TaskQueue
Returns:
true if the queue has more tasks not computed.
See Also:
TaskQueue.hasNext()

next

public Task next()
Description copied from class: TaskQueue
Return the next task to be computed, and remove it from the queue.

Specified by:
next in class TaskQueue
Returns:
the next task to be computed.
See Also:
TaskQueue.next()

flushAll

public void flushAll()
Description copied from class: TaskQueue
Empty the queue for a new computation.

Specified by:
flushAll in class TaskQueue
See Also:
TaskQueue.flushAll()

isHungry

public BooleanWrapper isHungry()
Specified by:
isHungry in class TaskQueue
Returns:
true if the queue has reached the hungry level.
See Also:
TaskQueue.isHungry()

setHungryLevel

public void setHungryLevel(int level)
Description copied from class: TaskQueue
Set the hungry level for this queue.

Specified by:
setHungryLevel in class TaskQueue
Parameters:
level - the starving task level.
See Also:
TaskQueue.setHungryLevel(int)

backupTasks

public void backupTasks(Task rootTask,
                        java.util.Vector pendingTasks,
                        java.io.OutputStream backupOutputStream)
Description copied from class: TaskQueue
Write all tasks for backuping.

Specified by:
backupTasks in class TaskQueue
Parameters:
rootTask - the root task.
pendingTasks - the pending tasks.
backupOutputStream - the stream for backuping.
See Also:
TaskQueue.backupTasks(org.objectweb.proactive.branchnbound.core.Task, java.util.Vector, java.io.OutputStream)

loadTasks

public void loadTasks(java.io.InputStream taskInputStream)
Description copied from class: TaskQueue
Restoring all tasks from a previous backup.

Specified by:
loadTasks in class TaskQueue
Parameters:
taskInputStream - the stream for restoring.
See Also:
TaskQueue.loadTasks(java.io.InputStream)

getRootTaskFromBackup

public Task getRootTaskFromBackup()
Description copied from class: TaskQueue
Restore the root task. The loadTasks(InputStream) must be called before.

Specified by:
getRootTaskFromBackup in class TaskQueue
Returns:
the root task from a restore.
See Also:
TaskQueue.getRootTaskFromBackup()

addResult

public void addResult(Result result)
Description copied from class: TaskQueue
Add a found result for the final gather.

Specified by:
addResult in class TaskQueue
Parameters:
result - the found result.
See Also:
TaskQueue.addResult(org.objectweb.proactive.branchnbound.core.Result)

howManyResults

public IntMutableWrapper howManyResults()
Specified by:
howManyResults in class TaskQueue
Returns:
the current total of result found.
See Also:
TaskQueue.howManyResults()

getAllResults

public java.util.Collection getAllResults()
Specified by:
getAllResults in class TaskQueue
Returns:
a Collection with all current found results.
See Also:
TaskQueue.getAllResults()

backupResults

public void backupResults(java.io.OutputStream backupOutputStream)
Description copied from class: TaskQueue
Backuping in a stream all current found results.

Specified by:
backupResults in class TaskQueue
Parameters:
backupOutputStream - the stream for backuping.
See Also:
TaskQueue.backupResults(java.io.OutputStream)

loadResults

public void loadResults(java.io.InputStream backupResultInputStream)
Description copied from class: TaskQueue
Restoring results from a backup.

Specified by:
loadResults in class TaskQueue
Parameters:
backupResultInputStream - the stream for restoring.
See Also:
TaskQueue.loadResults(java.io.InputStream)

addTask

public void addTask(Task t)
Description copied from class: TaskQueue
Add a task for computing in the queue.

Specified by:
addTask in class TaskQueue
Parameters:
t - the task to be computed.
See Also:
TaskQueue.addTask(org.objectweb.proactive.branchnbound.core.Task)


Copyright 2001-2005 INRIA All Rights Reserved.