org.mitre.sim.api3
Class Trigger

java.lang.Object
  extended byorg.mitre.sim.api3.Trigger
Direct Known Subclasses:
ReferencePopulation.TriggerBecomesEmpty, ReferencePopulation.TriggerExcludes, ReferencePopulation.TriggerIncludes, ReferencePopulation.TriggerSizeBelow, ReferencePopulation.TriggerSizeExceeds

public abstract class Trigger
extends java.lang.Object

Abstract class used to create all simulation developer defined triggers.


Copyright © 2003-2004 The MITRE Corporation


Constructor Summary
Trigger()
           
 
Method Summary
 void action()
          Override this method if a trigger-specific action is needed.
abstract  boolean condition()
          Decision logic of the trigger.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Trigger

public Trigger()
Method Detail

condition

public abstract boolean condition()
Decision logic of the trigger. Instances of trigger are used by simulation developers to detect changes in the simulation environment and trigger action in their entities. Triggers are used to wake up entities whose agendas are suspended in a call to waitForActionOrTrigger. The simulation executive may invoke this method an undetermined number of times. As a result, evaluation of the condition method should have no side effect in the simulation.

Returns:
The value of the developer supplied condition.
See Also:
Entity.waitForActionOrTrigger(Trigger[] cs, double backStop)

action

public void action()
Override this method if a trigger-specific action is needed. Invoked when the condition() method returns true, and the entity changes state from waitingForEvent to ready. That is, when this trigger causes an entity to resume. Method action() only gets invoked once when the state change occures but the executive may call method condition() repeatedly.


toString

public java.lang.String toString()
Returns:
the class name of the Trigger object.