com.xj.anylogic.engine
Class EventCondition

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

public class EventCondition
extends Event

Event with trigger of type condition. The event is executed when the condition becomes true. If the active object has continuously changing variables, the numeric engine constantly monitors the condition. In purely discrete models the condition is tested when something changes in the active obejct, i.e. when onChange() is called.
Memory: sizeof(Event) + 1 byte = 23 bytes

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

Constructor Summary
EventCondition(ActiveObject ao)
          Constructs the event object with Condition trigger.
 
Method Summary
 java.lang.String getName()
          Returns the name of the condition event as specified by the user.
 boolean isMonitoring()
          Returns true if this event is currently monitoring (waiting on) its condition.
 void onChange()
          Should be called when something changes in the object and probably condition changes.
 void onDestroy()
          Discards the scheduled event, if any (deletes it from the engine).
 void reset()
          Cancels the currently scheduled event, if any.
 void restart()
          Resumes waiting on the condition.
 void start()
          Should be called whe 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, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventCondition

public EventCondition(ActiveObject ao)
Constructs the event object with Condition 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 condition event as specified by the user.

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

reset

public void reset()
Cancels the currently scheduled event, if any. Stops waiting on the condition, (this can be later on resumed by calling restart()).

Specified by:
reset in class Event

restart

public void restart()
Resumes waiting on the condition. Can be called in the event action or when event is inactive.

Specified by:
restart in class Event

isMonitoring

public boolean isMonitoring()
Returns true if this event is currently monitoring (waiting on) its condition. This can be changed using reset() and restart() methods.

Returns:
true is event is monitoring the condition, false otherwise

start

public void start()
Should be called whe the active objects starts. Starts waiting on the condition. Checks if the condition is true at this moment and, if yes, schedules event immediately.

Specified by:
start in class Event

onChange

public void onChange()
Should be called when something changes in the object and probably condition changes. If Condition is true and event is not scheduled, schedules the event immediately. If condition is false, cancels the currently scheduled event, if any.


onDestroy

public void onDestroy()
Description copied from class: EventOriginator
Discards the scheduled event, if any (deletes it from the engine). Must be called when the active object is destroyed. We assume it is common behavior of all event originators

Overrides:
onDestroy in class EventOriginator


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