## mx4j.timer
Class TimeTask

    java.lang.Object
      mx4j.timer.TimeTask

All Implemented Interfaces:
  java.lang.Comparable, java.lang.Runnable

Direct Known Subclasses:
  TimerTask

public abstract class TimeTask
extends java.lang.Object
implements java.lang.Comparable, java.lang.Runnable

A task that is executed at a specified time.

Subclasses implement the periodicity, if needed. Two TimeTasks are compared with their neext execution time.

Version:
  $Revision: 1.3 $

Constructor Summary
`protected` `TimeTask()` Constructor for subclasses

Method Summary
`int` `compareTo(java.lang.Object obj)` Compares 2 TimeTasks by comparing their next execution times
`boolean` `getFixedRate()` Returns whether this task is a fixed rate or fixed delay task.
`protected long` `getNextExecutionTime()` Returns the next time at which the task will be executed, ie the `run()` method is called.
`protected long` `getPeriod()` Returns the period of this task.
`protected boolean` `isFinished()` Returns whethere this task is finished.
`protected boolean` `isPeriodic()` Returns whether this task is periodic.
`abstract void` `run()` The method to implement to have this TimeTask to do something.
`protected void` `setFinished(boolean value)` Marks this task as finished or not.
`protected void` `setNextExecutionTime(long time)` Sets the next execution time.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TimeTask

    protected TimeTask()

  Constructor for subclasses

Method Detail

### run

    public abstract void run()

  The method to implement to have this TimeTask to do something.

  Specified by:
    `run` in interface `java.lang.Runnable`

### isPeriodic

    protected boolean isPeriodic()

  Returns whether this task is periodic. By default return false.

  See Also:
    `getPeriod()`

### getPeriod

    protected long getPeriod()

  Returns the period of this task. By default returns 0.

  See Also:
    `isPeriodic()`

### getFixedRate

    public boolean getFixedRate()

  Returns whether this task is a fixed rate or fixed delay task. By default return false

### getNextExecutionTime

    protected long getNextExecutionTime()

  Returns the next time at which the task will be executed, ie the `run()` method is called.

  See Also:
    `setNextExecutionTime(long)`

### setNextExecutionTime

    protected void setNextExecutionTime(long time)

  Sets the next execution time.

  See Also:
    `getNextExecutionTime()`

### setFinished

    protected void setFinished(boolean value)

  Marks this task as finished or not. When a task is finished, its `run()` method will not be called anymore.

  See Also:
    `isFinished()`

### isFinished

    protected boolean isFinished()

  Returns whethere this task is finished.

  See Also:
    `setFinished(boolean)`

### compareTo

    public int compareTo(java.lang.Object obj)

  Compares 2 TimeTasks by comparing their next execution times

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  See Also:
    `getNextExecutionTime()`

Copyright © 2001-2003 MX4J Team. All Rights Reserved.