Packagecom.yworks.yfiles.util
Classpublic class Timer
InheritanceTimer Inheritance YObject Inheritance Object

Provides timer functionality. A timer is can either be in an activated or stopped state. A timer can sum up the time elapsed while it is in an activated state.



Public Properties
 PropertyDefined By
  active : Boolean
[read-only] Returns whether or not this timer is active right now.
Timer
  elapsedTime : LongImpl
[read-only] Returns the period of time the timer has been in an activated state since the last reset occurred.
Timer
  stopped : Boolean
[read-only] Returns whether or not this timer is stopped (not active) right now.
Timer
Public Methods
 MethodDefined By
  
Timer(init:Boolean = true)
Creates a new instance of a timer.
Timer
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
Timer
 Inherited
hashCode():int
YObject
  
[static] Creates a new instance of a timer.
Timer
  
newTimer2(activate:Boolean):Timer
[static] Creates a new instance of a timer, initially active or not.
Timer
  
reset():void
Resets the elapsed time to 0.
Timer
  
start():void
Starts or restarts this timer, if not already running.
Timer
  
stop():void
Stops this timer, if not already stopped.
Timer
  
toggle():void
Toggles the activation state if this timer.
Timer
  
toString():String
Returns the elapsed time as String in a minutes, seconds, milliseconds format.
Timer
Protected Methods
 MethodDefined By
  
initTimer1():void
Initializes this object.
Timer
  
initTimer2(activate:Boolean):void
Initializes this object.
Timer
Property Detail
activeproperty
active:Boolean  [read-only]

Returns whether or not this timer is active right now.


Implementation
    public function get active():Boolean
elapsedTimeproperty 
elapsedTime:LongImpl  [read-only]

Returns the period of time the timer has been in an activated state since the last reset occurred.


Implementation
    public function get elapsedTime():LongImpl
stoppedproperty 
stopped:Boolean  [read-only]

Returns whether or not this timer is stopped (not active) right now.


Implementation
    public function get stopped():Boolean
Constructor Detail
Timer()Constructor
public function Timer(init:Boolean = true)

Creates a new instance of a timer. The timer is initially active.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
getClass()method
override public function getClass():Class

Returns
Class
initTimer1()method 
protected final function initTimer1():void

Initializes this object. See the documentation of the corresponding factory method newTimer1() for details.

See also

initTimer2()method 
protected final function initTimer2(activate:Boolean):void

Initializes this object. See the documentation of the corresponding factory method newTimer2() for details.

Parameters

activate:Boolean

See also

newTimer1()method 
public static function newTimer1():Timer

Creates a new instance of a timer. The timer is initially active.

Returns
Timer
newTimer2()method 
public static function newTimer2(activate:Boolean):Timer

Creates a new instance of a timer, initially active or not.

Parameters

activate:Boolean — whether or not the timer should be initially active.

Returns
Timer
reset()method 
public function reset():void

Resets the elapsed time to 0. This method does not change the state (running or not) of this timer.

start()method 
public function start():void

Starts or restarts this timer, if not already running. The time elapsed will not be reset by this method.

stop()method 
public function stop():void

Stops this timer, if not already stopped.

toggle()method 
public function toggle():void

Toggles the activation state if this timer.

toString()method 
public function toString():String

Returns the elapsed time as String in a minutes, seconds, milliseconds format.

Returns
String