|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.aiken.util.lwtt.Task
public class Task
This class represents a tracked task.
Field Summary | |
---|---|
static int |
PERIOD
period for updating time values [ms] |
static double |
UNITS_PER_HOUR
time units per hour |
Constructor Summary | |
---|---|
Task()
Creates a new instance of Task |
|
Task(int id,
java.lang.String name,
long consumption,
double price)
Creates an instance for a task which has been already tracked. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Updates the time consumption value. |
int |
compareTo(Task t)
Compares this task to another one. |
long |
getConsumption()
Returns the current value of cumulative consumption [ms]. |
int |
getId()
Returns the task identifier. |
java.lang.String |
getName()
Returns the task name. |
static int |
getNewId()
Generates a new task identifier. |
double |
getPrice()
Returns the current price per hour [currency unit]. |
double |
getTotalPrice()
Returns the total price of this task [currency unit]. |
boolean |
isRunning()
Checks whether the task is running. |
void |
setActionListener(java.awt.event.ActionListener al)
Sets the listener where action events should be passed to. |
void |
setConsumption(long consumption)
Sets the task cumulative time consumption [ms]. |
void |
setName(java.lang.String name)
Sets the task name. |
void |
setPrice(double price)
Sets the price per hour [currency unit]. |
void |
start()
Starts tracking of this task. |
void |
stop()
Stops tracking of this task. |
java.lang.String |
toString()
Converts the instance to the string representation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int PERIOD
public static final double UNITS_PER_HOUR
Constructor Detail |
---|
public Task()
public Task(int id, java.lang.String name, long consumption, double price)
id
- task identifiername
- task nameconsumption
- up to now time consumptionprice
- price per hourMethod Detail |
---|
public static int getNewId()
public void setActionListener(java.awt.event.ActionListener al)
al
- action listenerpublic int getId()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- new task namepublic long getConsumption()
public void setConsumption(long consumption)
consumption
- new time consumption valuepublic void setPrice(double price)
price
- new price valuepublic double getPrice()
public double getTotalPrice()
public java.lang.String toString()
toString
in class java.lang.Object
public void start()
public void stop()
public boolean isRunning()
true
if running, false
otherwisepublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- action eventpublic int compareTo(Task t)
compareTo
in interface java.lang.Comparable<Task>
t
- another task
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |