org.chorem.jtimer.entities
Class TimerTask

java.lang.Object
  extended by org.chorem.jtimer.entities.TimerTask
All Implemented Interfaces:
Serializable, Cloneable, Comparable<TimerTask>
Direct Known Subclasses:
TimerProject

public class TimerTask
extends Object
implements Cloneable, Comparable<TimerTask>, Serializable

Represents a task. This task is cloneable using SerializationUtils (commons-lang).

Version:
$Revision: 2573 $ Last update : $Date: 2009-06-01 18:32:28 +0200 (lun. 01 juin 2009) $ By : $Author: chatellier $
Author:
chatellier
See Also:
SerializationUtils, Serialized Form

Field Summary
protected  SortedMap<Date,Long> allDaysAndTimes
          Map calendar of day -> time.
protected  SortedMap<Date,String> allDaysAnnotations
          Map date -> annotation text.
protected  boolean closed
          Closed task.
protected  Date creationDate
          Creation date.
protected  String name
          Task name.
protected  int number
          Task number.
protected  TimerTask parent
          Parent Task.
protected  List<TimerTask> subTasks
          Sub tasks.
 
Constructor Summary
TimerTask()
          Constructor.
TimerTask(String name)
          Constructor with name.
 
Method Summary
 void addAnnotation(Date date, String note)
          Add annotation.
 boolean addTask(TimerTask t)
          Add task's subtask.
 TimerTask clone()
          Clone task.
 int compareTo(TimerTask o)
           
 boolean equals(Object o)
           
 SortedMap<Date,Long> getAllDaysAndTimes()
          Return all data.
 SortedMap<Date,String> getAllDaysAnnotations()
          Return all annotation, sorted on date.
 Date getCreationDate()
          Get task creation date.
 String getName()
          Get task name.
 int getNumber()
          Get task number.
 TimerTask getParent()
          Get parent.
 List<TimerTask> getSubTasks()
          Get task's subtasks.
 long getTime(Date date)
          Get time at date.
 boolean isClosed()
          Get closed task state.
 void setClosed(boolean closed)
          Set closed.
 void setCreationDate(Date creationDate)
          Set task creation date.
 void setName(String name)
          Set task name.
 void setNumber(int number)
          Set task number.
protected  void setParent(TimerTask parent)
          Set parent.
 void setTime(Date date, Long seconds)
          Add time.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

number

protected int number
Task number.


name

protected String name
Task name.


creationDate

protected Date creationDate
Creation date.


closed

protected boolean closed
Closed task.


allDaysAndTimes

protected SortedMap<Date,Long> allDaysAndTimes
Map calendar of day -> time. (ordered on keys)


allDaysAnnotations

protected SortedMap<Date,String> allDaysAnnotations
Map date -> annotation text.


parent

protected TimerTask parent
Parent Task. More convenient


subTasks

protected List<TimerTask> subTasks
Sub tasks.

Constructor Detail

TimerTask

public TimerTask()
Constructor.


TimerTask

public TimerTask(String name)
Constructor with name.

Parameters:
name - task name
Method Detail

getNumber

public int getNumber()
Get task number.

Returns:
the number

setNumber

public void setNumber(int number)
Set task number.

Parameters:
number - the number to set

getName

public String getName()
Get task name.

Returns:
the name

setName

public void setName(String name)
Set task name.

Parameters:
name - the name to set

getCreationDate

public Date getCreationDate()
Get task creation date.

Returns:
task creation date

setCreationDate

public void setCreationDate(Date creationDate)
Set task creation date.

Parameters:
creationDate - creation date

isClosed

public boolean isClosed()
Get closed task state.

Returns:
true if task is closed

setClosed

public void setClosed(boolean closed)
Set closed.

Parameters:
closed - closed

getSubTasks

public List<TimerTask> getSubTasks()
Get task's subtasks.

Returns:
the subTasks

addTask

public boolean addTask(TimerTask t)
Add task's subtask. Also add parent reference.

Parameters:
t - the task to add
Returns:
success flag

setTime

public void setTime(Date date,
                    Long seconds)
Add time. Calendar will be forced to 0h00:00.000

Parameters:
date - date
seconds - seconds

getTime

public long getTime(Date date)
Get time at date.

Parameters:
date - date
Returns:
time at specified date

getAllDaysAndTimes

public SortedMap<Date,Long> getAllDaysAndTimes()
Return all data. Sorted on date.

Returns:
total duration of all projects

addAnnotation

public void addAnnotation(Date date,
                          String note)
Add annotation.

Parameters:
date - date
note - note text

getAllDaysAnnotations

public SortedMap<Date,String> getAllDaysAnnotations()
Return all annotation, sorted on date.

Returns:
annotations

getParent

public TimerTask getParent()
Get parent. Can be null if there is no parent.

Returns:
the parent

setParent

protected void setParent(TimerTask parent)
Set parent.

Parameters:
parent - the parent to set

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

clone

public TimerTask clone()
Clone task.

Overrides:
clone in class Object
Returns:
task copy

compareTo

public int compareTo(TimerTask o)
Specified by:
compareTo in interface Comparable<TimerTask>


Copyright © 2007-2009 CodeLutin. All Rights Reserved.