edu.memphis.ccrg.lida.globalworkspace.triggers
Class AggregateCoalitionActivationTrigger

java.lang.Object
  extended by edu.memphis.ccrg.lida.globalworkspace.triggers.AggregateCoalitionActivationTrigger
All Implemented Interfaces:
BroadcastTrigger
Direct Known Subclasses:
IndividualCoaltionActivationTrigger

public class AggregateCoalitionActivationTrigger
extends java.lang.Object
implements BroadcastTrigger

Implements a trigger that is activated when the sum of all Coalition objects in GlobalWorkspace is greater than a threshold.

Author:
Javier Snaider

Field Summary
protected  GlobalWorkspace gw
          Reference to the GlobalWorkspace
protected  double threshold
          The activation threshold
 
Constructor Summary
AggregateCoalitionActivationTrigger()
           
 
Method Summary
 void checkForTriggerCondition(java.util.Collection<Coalition> coalitions)
          Calculates the aggregate activation of all coalitions in the GlobalWorkspace and if it is over threshold a broadcast is triggered.
 double getThreshold()
          Gets threshold
 void init(java.util.Map<java.lang.String,java.lang.Object> parameters, GlobalWorkspace gw)
          This method expects a parameter with name "threshold" of type double representing the coalition activation threshold at which the trigger will fire.
 void reset()
          Resets the trigger.
 void start()
          Starts the trigger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gw

protected GlobalWorkspace gw
Reference to the GlobalWorkspace


threshold

protected double threshold
The activation threshold

Constructor Detail

AggregateCoalitionActivationTrigger

public AggregateCoalitionActivationTrigger()
Method Detail

checkForTriggerCondition

public void checkForTriggerCondition(java.util.Collection<Coalition> coalitions)
Calculates the aggregate activation of all coalitions in the GlobalWorkspace and if it is over threshold a broadcast is triggered. This method is called each time a new Coalition enters the GlobalWorkspace

Specified by:
checkForTriggerCondition in interface BroadcastTrigger
Parameters:
coalitions - a Collection of all the Coalition objects in the GlobalWorkspace.
See Also:
GlobalWorkspaceImpl.addCoalition(Coalition)

reset

public void reset()
Description copied from interface: BroadcastTrigger
Resets the trigger. Called each time a new broadcast is triggered.

Specified by:
reset in interface BroadcastTrigger

init

public void init(java.util.Map<java.lang.String,java.lang.Object> parameters,
                 GlobalWorkspace gw)
This method expects a parameter with name "threshold" of type double representing the coalition activation threshold at which the trigger will fire.

Specified by:
init in interface BroadcastTrigger
Parameters:
parameters - a map for generic parameters
gw - A TriggerListener and likely a class that implements the GlobalWorkspace interface.
See Also:
BroadcastTrigger.init(Map, GlobalWorkspace)

start

public void start()
Description copied from interface: BroadcastTrigger
Starts the trigger.

Specified by:
start in interface BroadcastTrigger

getThreshold

public double getThreshold()
Gets threshold

Returns:
threshold to activate the trigger