com.benfante.splasher.task
Class AbstractTask

java.lang.Object
  extended by com.benfante.splasher.task.AbstractTask
All Implemented Interfaces:
Task, java.lang.Runnable
Direct Known Subclasses:
FakeTask, SimpleTask

public abstract class AbstractTask
extends java.lang.Object
implements Task

Base implementation for task classes.

Version:
$Id: AbstractTask.java,v 1.1.1.1 2006-04-01 05:41:35 lucio Exp $
Author:
Lucio Benfante lucio@benfante.com

Field Summary
protected  int completed
          The percent of completion of the task
static int COMPLETED
           
protected  java.lang.String description
           
protected  int weight
           
 
Constructor Summary
AbstractTask(java.lang.String description, int weight)
          Creates a new instance of AbstractTask.
 
Method Summary
 void add(TaskObserver observer)
          Add a task observer.
 int getCompleted()
          Return the percent of completion of the task.
 java.lang.String getDescription()
          Return the description of the task.
 int getWeight()
          Return the weight of the task.
 boolean isCompleted()
          Check if the task is completed.
 void notifyChanges()
          Notify changes to the task observer(s).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

COMPLETED

public static final int COMPLETED
See Also:
Constant Field Values

description

protected java.lang.String description

weight

protected int weight

completed

protected int completed
The percent of completion of the task

Constructor Detail

AbstractTask

public AbstractTask(java.lang.String description,
                    int weight)
Creates a new instance of AbstractTask.

Parameters:
description - A description for the task
weight - The weight of this task (relative to the other tasks)
Method Detail

add

public void add(TaskObserver observer)
Add a task observer.

Specified by:
add in interface Task
Parameters:
observer - The task observer that will be notified about changes on this task.

getCompleted

public int getCompleted()
Return the percent of completion of the task.

Specified by:
getCompleted in interface Task
Returns:
The percent of completion of the task.

getDescription

public java.lang.String getDescription()
Return the description of the task.

Specified by:
getDescription in interface Task
Returns:
The description of the task.

getWeight

public int getWeight()
Return the weight of the task.

Specified by:
getWeight in interface Task
Returns:
The weight of the task.

isCompleted

public boolean isCompleted()
Check if the task is completed.

Specified by:
isCompleted in interface Task
Returns:
true if the task is completed.

notifyChanges

public void notifyChanges()
Notify changes to the task observer(s).

Specified by:
notifyChanges in interface Task