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.

Version:
$Revision: 2848 $ Last update : $Date: 2012-03-28 18:37:31 +0200 (Wed, 28 Mar 2012) $ By : $Author: echatellier $
Author:
chatellier
See Also:
Serialized Form

Field Summary
protected  List<TimerAlert> alerts
          Task alerts.
protected  SortedMap<Date,String> allDaysAnnotations
          Map date -> annotation text.
protected  SortedMap<Date,Long> allDaysTimes
          Map calendar of day -> time (ms).
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.
protected  String uuid
          Task uuid used to managed task equality.
 
Constructor Summary
TimerTask()
          Constructor.
TimerTask(String name)
          Constructor with name.
 
Method Summary
 void addAlert(TimerAlert alert)
          Add alert.
 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)
           
 List<TimerAlert> getAlerts()
          Get alert list.
 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.
 int hashCode()
           
 boolean isClosed()
          Get closed task state.
 void setAlert(List<TimerAlert> alerts)
          Set alert.
 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 time)
          Add time.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

uuid

protected String uuid
Task uuid used to managed task equality.


number

protected int number
Task number.


name

protected String name
Task name.


creationDate

protected Date creationDate
Creation date.


closed

protected boolean closed
Closed task.


parent

protected TimerTask parent
Parent Task. More convenient


allDaysTimes

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


allDaysAnnotations

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


subTasks

protected List<TimerTask> subTasks
Sub tasks.


alerts

protected List<TimerAlert> alerts
Task alerts.

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

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

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 time)
Add time.

Parameters:
date - date
time - time in ms

getTime

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

Parameters:
date - date
Returns:
time at specified date in ms

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

addAlert

public void addAlert(TimerAlert alert)
Add alert.

Parameters:
alert -

getAlerts

public List<TimerAlert> getAlerts()
Get alert list.

Returns:
alerts

setAlert

public void setAlert(List<TimerAlert> alerts)
Set alert.

Parameters:
alerts - new alerts list

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode 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-2012 CodeLutin. All Rights Reserved.