Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lbg.peer.workflow
Class BoT

    java.lang.Object
      lbg.peer.workflow.BoT

    public class BoT

extends java.lang.Object

Bag of Tasks.

Each Task is always in one of three states: unscheduled, scheduled and completed.

Tasks of Bag of Tasks are therefore separated into 3 sets, each of which is backed by a heap.

Scheduled and completed Tasks are stored according to their nominal id. Unscheduled Tasks are stored by their scheduling id, rather than by their nominal id, so as to preserve Temporal Task Grouping, i.e. scheduling decisions taken prior to the construction of the BoT.

Author:
  Cyril Briquet

Constructor Summary
`BoT(int job_id, int bot_id, Task[] tasks, MetaGridData[] datas, boolean is_supplying_task)`

Method Summary
`java.util.Iterator<Task>` | `completedTasks()`
`int` | `countCompletedTasks()`
`int` | `countScheduledTasks()`
`int` | `countUncompletedTasks()`
`int` | `countUnscheduledTasks()`
`RequestContainer` | `flagTaskAsCompleted(Task returning_t)`
`RequestContainer` | `flagTaskAsUnscheduled(Task returning_t, boolean resync)`
`MetaGridData[]` | `getUniqueMetaGridDatas()` Set of all data required by the BoT.
`boolean` | `hasCompletedTasks()`
`boolean` | `hasScheduledTasks()`
`boolean` | `hasUnscheduledTasks()`
`int` | `id()`
`boolean` | `isCompleted()`
`int` | `jobID()`
`Task` | `peekFirstSupplyingTask()` Peeks at the Supplying Task that would selected for scheduling.
`java.util.Iterator<Task>` | `scheduledTasks()`
`RequestContainer` | `selectFirstConsumptionTask()`
`RequestContainer` | `selectFirstLocalTask()`
`RequestContainer` | `selectFirstSupplyingTask()`
`RequestContainer` | `selectNextConsumptionTask(LocalQueueCursor lqc)` Selects next Consumption Task to schedule.
`int` | `tasksCount()`
`java.lang.String` | `toString()`
`java.util.Iterator<Task>` | `unscheduledTasks()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### BoT

    public BoT(int job_id,
               int bot_id,
               Task[] tasks,
               MetaGridData[] datas,
               boolean is_supplying_task)
        throws GridException

Throws:
  `GridException`

Method Detail

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### jobID

    public int jobID()

### id

    public int id()

### tasksCount

    public int tasksCount()

### unscheduledTasks

    public java.util.Iterator<Task> unscheduledTasks()

### hasUnscheduledTasks

    public boolean hasUnscheduledTasks()

### countUnscheduledTasks

    public int countUnscheduledTasks()

### scheduledTasks

    public java.util.Iterator<Task> scheduledTasks()

### hasScheduledTasks

    public boolean hasScheduledTasks()

### countScheduledTasks

    public int countScheduledTasks()

### completedTasks

    public java.util.Iterator<Task> completedTasks()

### hasCompletedTasks

    public boolean hasCompletedTasks()

### countCompletedTasks

    public int countCompletedTasks()

### countUncompletedTasks

    public int countUncompletedTasks()

### isCompleted

    public boolean isCompleted()

### getUniqueMetaGridDatas

    public MetaGridData[] getUniqueMetaGridDatas()

  Set of all data required by the BoT.

  Returns:
    set of all data required by the BoT

### selectFirstLocalTask

    public RequestContainer selectFirstLocalTask()
                                          throws GridException

  Throws:
    `GridException`

### selectFirstConsumptionTask

    public RequestContainer selectFirstConsumptionTask()
                                                throws GridException

  Throws:
    `GridException`

### selectNextConsumptionTask

    public RequestContainer selectNextConsumptionTask(LocalQueueCursor lqc)
                                               throws GridException

  Selects next Consumption Task to schedule.

  Returns:
    next Consumption Task to schedule, or null if the Task referenced by the Local queue cursor was the less prioritary unscheduled Task
  Throws:
    `GridException` - if a parameter is illegal

### peekFirstSupplyingTask

    public Task peekFirstSupplyingTask()
                                throws GridException

  Peeks at the Supplying Task that would selected for scheduling.

  Recommendation: use this method only for waiting Supplying Tasks, as the Task is selected without update of the BoT state.

  Returns:
    Supplying Task that would selected for scheduling
  Throws:
    `GridException`

### selectFirstSupplyingTask

    public RequestContainer selectFirstSupplyingTask()
                                              throws GridException

  Throws:
    `GridException`

### flagTaskAsUnscheduled

    public RequestContainer flagTaskAsUnscheduled(Task returning_t,
                                                  boolean resync)
                                           throws GridException

  Parameters:
    `returning_t` - returning Task, i.e. copy of the original Task (that comes back from another Grid node)
    `resync` - if true, resynchronizes the metadata of the original Task with the returning Task
  Throws:
    `GridException`

### flagTaskAsCompleted

    public RequestContainer flagTaskAsCompleted(Task returning_t)
                                         throws GridException

  Throws:
    `GridException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

> Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.