edu.ucla.belief.io
Class NodeLinearTask

Object
  extended by NodeLinearTask
All Implemented Interfaces:
ProgressMonitorable

public class NodeLinearTask
extends Object
implements ProgressMonitorable

A task that we expect to run in time roughly linear in the number of nodes a model contains. The linear factor corresponds to the number of "steps" that makeup this task, i.e. how many times we expect the overall task to process each node.

Since:
20060519
Author:
keith cascio

Constructor Summary
NodeLinearTask(String description, Estimate estimate, int steps, String[] notes)
           
 
Method Summary
 ProgressMonitorable[] decompose()
          Simple task decomposes into only itself.
 String getDescription()
           
 String getNote()
           
 int getProgress()
           
 int getProgressMax()
           
 boolean isFinished()
           
 void join(long timeout)
          important: relies on setFinished(true)
 void setFinished(boolean flag)
          It is preferable for the code that creates this task to call setFinished(true) when the task is certainly completed.
 void touch()
          The computation code should call this every time it processes a node, thus updating the overall progress.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeLinearTask

public NodeLinearTask(String description,
                      Estimate estimate,
                      int steps,
                      String[] notes)
Parameters:
steps - The linear factor, i.e. how many times we expect the overall task to process each node.
notes - Array should have the same size as the steps parameter. One note for each "step" of the task.
Method Detail

touch

public void touch()
The computation code should call this every time it processes a node, thus updating the overall progress.


getProgress

public int getProgress()
Specified by:
getProgress in interface ProgressMonitorable

getProgressMax

public int getProgressMax()
Specified by:
getProgressMax in interface ProgressMonitorable

isFinished

public boolean isFinished()
Specified by:
isFinished in interface ProgressMonitorable

join

public void join(long timeout)
          throws InterruptedException
important: relies on setFinished(true)

Throws:
InterruptedException
Since:
20060522

setFinished

public void setFinished(boolean flag)
It is preferable for the code that creates this task to call setFinished(true) when the task is certainly completed. setFinished(false) is useless.


getNote

public String getNote()
Specified by:
getNote in interface ProgressMonitorable
Returns:
The appropriate note by infering the step from the fraction of overall progress.

decompose

public ProgressMonitorable[] decompose()
Simple task decomposes into only itself.

Specified by:
decompose in interface ProgressMonitorable

getDescription

public String getDescription()
Specified by:
getDescription in interface ProgressMonitorable


Copyright 2010 UCLA Automated Reasoning Group