com.xj.anylogic.engine
Class EventRate

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

public class EventRate
extends Event

Event with trigger of type rate. Such event is executed periodically with time intervals distributed exponentially with the parameter rate, i.e. if the rate is 5, the event will occur on average 5 times per time unit. If the rate changes dynamically, the event occurrence gets re-scheduled; such changes may only be noticed by EventRate if onChange() is called for the active object.
Memory: sizeof(Event) + 8 = 30 bytes

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

Constructor Summary
EventRate(ActiveObject ao)
          Constructs the event object with Rate trigger.
 
Method Summary
 java.lang.String getName()
          Returns the name of the rate event as specified by the user.
 void onChange()
          Should be called when something changes in the object (and probably the rate changes).
 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 Rate.
 void start()
          Should be called when the active objects starts.
 
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

EventRate

public EventRate(ActiveObject ao)
Constructs the event object with Rate 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 rate event as specified by the user.

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

reset

public void reset()
Cancels the currently scheduled event, if any. The cyclic execution would not resume until restart() 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 Rate.

Specified by:
restart in class Event

start

public void start()
Should be called when the active objects starts. Schedules the first occurrence at the time exponentially distributed with the specified Rate

Specified by:
start in class Event

onChange

public void onChange()
Should be called when something changes in the object (and probably the rate changes). Re-schedules the event with re-calculated rate.



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