Package com.anylogic.engine
- java.lang.Object
- com.anylogic.engine.EventOriginator
- com.anylogic.engine.Event
- com.anylogic.engine.EventTimeout
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,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 cyclic
and set to occur at startup.
Memory: sizeof(Event) + 8 bytes = 30 bytes
Memory: sizeof(Event) + 8 bytes = 30 bytes
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Class | Description |
---|---|---|
static enum | EventTimeout.Mode |
Constructor | Description |
---|---|
EventTimeout |
Constructs the event object with Timeout trigger.
|
Modifier and Type | Method | Description |
---|---|---|
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 |
Cancels the currently scheduled event, if any, and
schedules the next occurrence in time
t . |
void | restart |
Cancels the currently scheduled event, if any, and
schedules the next occurrence in time
t . |
void | restartTo |
Cancels the currently scheduled event, if any, and
schedules the next occurrence at the (absolute) model time
time . |
void | restartTo |
Cancels the currently scheduled event, if any, and
schedules the next occurrence at the (absolute) model time
time expressed in the given units . |
void | restartTo |
Cancels the currently scheduled event, if any, and
schedules the next occurrence at the (absolute) model date
date . |
void | resume() |
Re-schedules the previously suspended event in the remaining time.
|
void | start() |
Should be called when the agents starts.
|
void | suspend() |
Cancels the currently scheduled event, if any, and remembers the
remaining time so that it can be resumed by calling
resume() . |
public EventTimeout(Agent ao)
Constructs the event object with Timeout trigger. Does not start it.
- Parameters:
ao
- agent where this event belongs to
public String getName()
Returns the name of the timeout event as specified by the user.
- Specified by:
getName
in classEventOriginator
- Returns:
- The name of the timeout event
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.public void restart()
Cancels the currently scheduled event, if any, and
schedules the next occurrence according to the Timeout specified
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)
public void restart(double timeout, TimeUnits units)
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.units
- the time units- Since:
- 7.1
- See Also:
public void restartTo(double time)
Cancels the currently scheduled event, if any, and
schedules the next occurrence at the (absolute) model time
This method seems to be like the call
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.
public void restartTo(double time, TimeUnits units)
Cancels the currently scheduled event, if any, and
schedules the next occurrence at the (absolute) model time
This method seems to be like the call
time
expressed in the given units
. 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(units), units )
,
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.units
- the time units- Since:
- 7.1
public void restartTo(Date date)
Cancels the currently scheduled event, if any, and
schedules the next occurrence at the (absolute) model date
This method seems to be like the call
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.
public void suspend()
Cancels the currently scheduled event, if any, and remembers the
remaining time so that it can be resumed by calling
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
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()
.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.
@AnyLogicInternalCodegenAPI public void start()
Should be called when the agents starts. Performs initial
event scheduling according to mode (CYCLIC, ONCE, USER).