jabble
Class Trigger

java.lang.Object
  extended by jabble.Trigger
Direct Known Subclasses:
OutsideRangeTrigger, OverThresholdTrigger, TimeTrigger, UnderThresholdTrigger

public abstract class Trigger
extends java.lang.Object

A condition that can halt the evolution. Typically a Trigger will add a condition on an Indicator, such as "when an indicator is above a threshold".


Field Summary
protected  Indicator indicator
          The indicator associated with the Trigger, or null if no indicator is used.
 
Constructor Summary
Trigger()
          Creates a trigger that doesn't use an indicator.
Trigger(Indicator indicator)
          Creates a trigger that uses an indicator: setupFields, init and processPoint will be forwarded to the indicator.
 
Method Summary
 void init()
          Initializes the trigger, resetting the trigger computation.
abstract  boolean isVerified()
          Returns whether the Trigger is verified.
 void processPoint(Point point)
          Updates the trigger computation using the values at the point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indicator

protected final Indicator indicator
The indicator associated with the Trigger, or null if no indicator is used.

Constructor Detail

Trigger

public Trigger()
Creates a trigger that doesn't use an indicator.


Trigger

public Trigger(Indicator indicator)
Creates a trigger that uses an indicator: setupFields, init and processPoint will be forwarded to the indicator.

Parameters:
indicator - the Indicator to be used by the Trigger
Method Detail

init

public void init()
Initializes the trigger, resetting the trigger computation.


processPoint

public void processPoint(Point point)
Updates the trigger computation using the values at the point.

Parameters:
point - the point for this calculation step.

isVerified

public abstract boolean isVerified()
Returns whether the Trigger is verified. This function has a valid value only after the init() method call and a full iteration over the Grid using processPoint(). Results are undetermined otherwise.

Returns:
true if the trigger condition is verified.