Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.util   Previous This
Package
Next

 


Class Timer

public class Timer
{
  // Constructors
  public Timer(long p);
  public Timer(long p, int id);
  public Timer(long p, boolean r);
  public Timer(long p, int id, boolean r);
  public Timer(TimerListener defaultListener, long p);
  public Timer(TimerListener defaultListener, long p, int id);
  public Timer(TimerListener defaultListener, long p, boolean r);
  public Timer(TimerListener defaultListener, long p, int id,
        boolean r);
  public Timer(TaskManager tm, long p);
  public Timer(TaskManager tm, long p, int id);
  public Timer(TaskManager tm, long p, boolean r);
  public Timer(TaskManager tm, long p, int id, boolean r);
  public Timer(TaskManager tm, TimerListener defaultListener,
        long p);
  public Timer(TaskManager tm, TimerListener defaultListener,
        long p, int id);
  public Timer(TaskManager tm, TimerListener defaultListener,
        long p, boolean r);
  public Timer(TaskManager tm, TimerListener defaultListener,
        long p, int id, boolean r);

  // Methods
  public void addTimerListener(TimerListener listener);
  public long getPeriod();
  public boolean getRepeat();
  public int getUserID();
  public boolean isRunning();
  public void removeTimerListener(TimerListener listener);
  public void start();
  public void stop();
}

This class implements a timer event source.

Constructors

Timer

public Timer(long p);

Constructs a one-shot timer with the specified period (in milliseconds).

ParameterDescription
p The initial period of the timer.

Timer

public Timer(long p, int id);

Constructs a one-shot timer with a specific period (in milliseconds) and that includes a user-defined identifier.

ParameterDescription
p The initial period of the timer.
id The user-defined identifier of the timer.

Timer

public Timer(long p, boolean r);

Constructs a one-shot or repeating timer with the specified period (in milliseconds).

ParameterDescription
p The initial period of the timer.
r Set to true if the timer is a repeating timer or false if it is a one-shot timer.

Timer

public Timer(long p, int id, boolean r);

Constructs a one-shot or repeating timer with the specified period (in milliseconds).

ParameterDescription
p The initial period of the timer.
id The user-defined identifier for the timer.
r Set to true if the timer is a repeating timer; set to false if it is a one-shot timer.

Timer

public Timer(TimerListener defaultListener, long p);

Constructs a one-shot timer with the specified period (in milliseconds) and that includes a default listener.

ParameterDescription
defaultListener The initial listener to add to the timer.
p The initial period of the timer.

Timer

public Timer(TimerListener defaultListener, long p, int id);

Constructs a one-shot timer with the specified period (in milliseconds) and listener.

ParameterDescription
defaultListener The initial listener to add to the timer.
p The initial period of the timer.
id The user-defined identifier of the timer.

Timer

public Timer(TimerListener defaultListener, long p, boolean r);

Constructs a one-shot or repeating timer with the specified period (in milliseconds) and that includes a default listener.

ParameterDescription
defaultListener The initial listener to add to the timer.
p The initial period of the timer.
r Set to true if the timer is a repeating timer; set to false if it is a one-shot timer.

Timer

public Timer(TimerListener defaultListener, long p, int id, boolean r);

Constructs a one-shot or repeating timer with the specified period (in milliseconds) and a default listener.

ParameterDescription
defaultListener An initial listener to add to the timer.
id A user-defined identifier for the listener.
p The initial period of the timer.
r Set to true if the timer is a repeating timer; set to false if it is a one-shot timer.

Timer

public Timer(TaskManager tm, long p);

Constructs a one-shot timer with the specified period.

ParameterDescription
tm The TaskManager that is to service this Timer.
p The initial period of the timer (in milliseconds).

Timer

public Timer(TaskManager tm, long p, int id);

Constructs a one-shot timer with a specific period and that includes a user-defined identifier.

ParameterDescription
tm The TaskManager that is to service this Timer.
p The initial period of the timer (in milliseconds).
id The user-defined identifier of the timer.

Timer

public Timer(TaskManager tm, long p, boolean r);

Constructs a one-shot or repeating timer with the specified period.

ParameterDescription
tm The task manager that is to service this timer.
p The initial period of the timer (in milliseconds).
r Set to true if the timer is a repeating timer or false if it is a one-shot timer.

Timer

public Timer(TaskManager tm, long p, int id, boolean r);

Constructs a one-shot or repeating timer with the specified period.

ParameterDescription
tm The task manager that is to service this timer.
p The initial period of the timer (in milliseconds).
id The user-defined identifier for the timer.
r Set to true if the timer is a repeating timer; set to false if it is a one-shot timer.

Timer

public Timer(TaskManager tm, TimerListener defaultListener, long p);

Constructs a one-shot timer with the specified period and that includes a default listener.

ParameterDescription
tm The task manager that is to service this timer.
defaultListener The initial listener to add to the timer.
p The initial period of the timer.

Timer

public Timer(TaskManager tm, TimerListener defaultListener, long p, int id);

Constructs a one-shot timer with the specified period and listener.

ParameterDescription
tm The task manager that is to service this timer.
defaultListener The initial listener to add to the timer.
p The initial period of the timer.
id The user-defined identifier of the timer.

Timer

public Timer(TaskManager tm, TimerListener defaultListener, long p, boolean
        r);

Constructs a one-shot or repeating timer with the specified period and that includes a default listener.

ParameterDescription
tm The task manager that is to service this timer.
defaultListener The initial listener to add to the timer.
p The initial period of the timer.
r Set to true if the timer is a repeating timer; set to false if it is a one-shot timer.

Timer

public Timer(TaskManager tm, TimerListener defaultListener, long p, int id,
        boolean r);

Constructs a one-shot or repeating timer with the specified period and a default listener.

ParameterDescription
tm The task manager that is to service this timer.
defaultListener An initial listener to add to the timer.
id A user-defined identifier for the listener.
p The initial period of the timer.
r Set to true if the timer is a repeating timer; set to false if it is a one-shot timer.

Methods

addTimerListener

public void addTimerListener(TimerListener listener);

Adds a listener to the timer.

Return Value:

No return value.

ParameterDescription
listener The listener that is added to the timer.

getPeriod

public long getPeriod();

Retrieves the timer period.

Return Value:

Returns the number of milliseconds that must elapse before the timer fires.

getRepeat

public boolean getRepeat();

Retrieves the timer repeat flag.

Return Value:

Returns true if the timer is a repeating timer; otherwise, returns false.

getUserID

public int getUserID();

Retrieves the timer's user-defined identifier.

Return Value:

Returns the integer identifier of the timer.

isRunning

public boolean isRunning();

Queries the Timer to see if it is running.

Return Value:

Returns true if the timer is running; otherwise, returns false.

removeTimerListener

public void removeTimerListener(TimerListener listener);

Removes a listener from the timer.

Return Value:

No return value.

ParameterDescription
listener The listener that is removed.

Remarks:

This method prevents future listener timer events from being generated. However, timer events that have already been generated can be delivered to listeners.

start

public void start();

Starts the timer. If the timer is already running, calls to this method are ignored.

Return Value:

No return value.

stop

public void stop();

Stops the timer. If the timer is not running, calls to this method are ignored.

Return Value:

No return value.

Remarks:

This method prevents future listener timer events from being generated. However, timer events that have already been generated can be delivered to listeners.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.