com.xj.anylogic.engine
Class EventTimeout

java.lang.Object
  extended by com.xj.anylogic.engine.EventOriginator
      extended by com.xj.anylogic.engine.Event
          extended by com.xj.anylogic.engine.EventTimeout
All Implemented Interfaces:
com.xj.anylogic.engine.internal.Child, java.io.Serializable

public class EventTimeout
extends Event

Event with trigger of type timeout. The event occurs exactly in timeout time after it is started. Optionally, the event may be made cylcic and set to occur at startup.
Memory: sizeof(Event) + 8 bytes = 30 bytes

Author:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
Serialized Form

Constructor Summary
EventTimeout(ActiveObject ao)
          Constructs the event object with Timeout trigger.
 
Method Summary
 java.lang.String getName()
          Returns the name of the timeout event as specified by the user.
 void reset()
          Cancels the currently scheduled event, if any.
 void restart()
          Cancels the currently scheduled event, if any, and schedules the next occurrence according to the Timeout specified
 void restart(double timeout)
          Cancels the currently scheduled event, if any, and schedules the next occurrence in time t.
 void restartTo(java.util.Date date)
          Cancels the currently scheduled event, if any, and schedules the next occurrence at the (absolute) model date date.
 void restartTo(double time)
          Cancels the currently scheduled event, if any, and schedules the next occurrence at the (absolute) model time time.
 void resume()
          Re-schedules the previously suspended event in the remaining time.
 void start()
          Should be called whe the active objects starts.
 void suspend()
          Cancels the currently scheduled event, if any, and remembers the remaining time so that it can be resumed by calling resume().
 
Methods inherited from class com.xj.anylogic.engine.Event
restoreOwner
 
Methods inherited from class com.xj.anylogic.engine.EventOriginator
cancel, getActiveObject, getFullName, getRest, isActive, onDestroy, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventTimeout

public EventTimeout(ActiveObject ao)
Constructs the event object with Timeout trigger. Does not start it.

Parameters:
ao - active object where this event belongs to
Method Detail

getName

public java.lang.String getName()
Returns the name of the timeout event as specified by the user.

Specified by:
getName in class EventOriginator
Returns:
The name of the timeout event

reset

public void reset()
Cancels the currently scheduled event, if any. In case the event is Cyclic, the cycle would not resume until restart() or restart(double) is called.

Specified by:
reset in class Event

restart

public void restart()
Cancels the currently scheduled event, if any, and schedules the next occurrence according to the Timeout specified

Specified by:
restart in class Event

restart

public void restart(double timeout)
Cancels the currently scheduled event, if any, and schedules the next occurrence in time t. If the event is Cyclic, it will then continue occurring at the original timeout/rate.

Parameters:
timeout - time (from now) in which the event will be scheduled.
See Also:
restartTo(double)

restartTo

public void restartTo(double time)
Cancels the currently scheduled event, if any, and schedules the next occurrence at the (absolute) model time time. If the event is Cyclic, it will then continue occurring at the original timeout/rate.
This method seems to be like the call restart( time - time() ), but it is different because it eliminates numeric calculation error which may occur on any machine.

Parameters:
time - model time (absolute) at which the event will be scheduled.

restartTo

public void restartTo(java.util.Date date)
Cancels the currently scheduled event, if any, and schedules the next occurrence at the (absolute) model date date. If the event is Cyclic, it will then continue occurring at the original timeout/rate.
This method seems to be like the call restart( toTimeout(...) ), but it is different because it eliminates numeric calculation error which may occur on any machine.

Parameters:
date - model date at which the event will be scheduled.

suspend

public void suspend()
Cancels the currently scheduled event, if any, and remembers the remaining time so that it can be resumed by calling resume(). If the event is not scheduled at the time of calling suspend(), the subsequent resume will result in nothing.
Note that you should not call this method (i.e. should not try to suspend the event) from its own action code: it will have the effect of reset().


resume

public void resume()
Re-schedules the previously suspended event in the remaining time. Does nothing if event was never suspended or was reset or restarted after it was last suspended.


start

public void start()
Should be called whe the active objects starts. Performs initial event scheduling according to mode (CYCLIC, ONCE, USER).

Specified by:
start in class Event


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.