de.cau.cs.kieler.core.kivi
Class AbstractTrigger

java.lang.Object
  extended by de.cau.cs.kieler.core.kivi.AbstractTrigger
All Implemented Interfaces:
ITrigger
Direct Known Subclasses:
ButtonTrigger, DiagramTrigger, EffectTrigger, KSBasETrigger, ModelChangeTrigger, PartTrigger, ReInitDiagramDoneTrigger, SelectionTrigger, SignalFlowTrigger, StateActivityTrigger, StateMachineSimulationTrigger, TestTriggerA, TestTriggerB, TestTriggerSpammer, TestTriggerSpammerSynchronized, XtextBasedEditorActivationChangeTrigger

public abstract class AbstractTrigger
extends Object
implements ITrigger

Abstract base implementation for triggers.

Rating red

Constructor Summary
AbstractTrigger()
           
 
Method Summary
 boolean isActive()
          Checks whether the trigger is active or not.
abstract  void register()
          Called when the trigger is activated, e.g., if KIVi is (re-)activated or the first ICombination being fired by such a trigger is loaded.
 void setActive(boolean a)
          Called by the view management to register or unregister this trigger.
 void synchronizedTrigger(ITriggerState triggerState)
          Triggers a TriggerState just as trigger(ITriggerState), but blocks this thread until all effects that are created following this trigger are executed on the effects thread.
 void trigger(ITriggerState triggerState)
          Inform the view management about an event.
abstract  void unregister()
          Called when the trigger is deactivated, e.g., if the whole KIVi is deactivated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTrigger

public AbstractTrigger()
Method Detail

trigger

public void trigger(ITriggerState triggerState)
Inform the view management about an event. Call this method when the specific trigger implementation has detected an event.

Specified by:
trigger in interface ITrigger
Parameters:
triggerState - new instance of the corresponding trigger state class

synchronizedTrigger

public void synchronizedTrigger(ITriggerState triggerState)
                         throws InterruptedException
Triggers a TriggerState just as trigger(ITriggerState), but blocks this thread until all effects that are created following this trigger are executed on the effects thread. Hence this method can be used to create back pressure and block the triggering of new effects until all old effects have been executed. Therefore the effects queue will not explode.

Parameters:
triggerState - the new state that KIVi should distribute
Throws:
InterruptedException - if the blocking is interrupted

setActive

public void setActive(boolean a)
Called by the view management to register or unregister this trigger.

Specified by:
setActive in interface ITrigger
Parameters:
a - true if registering

isActive

public boolean isActive()
Checks whether the trigger is active or not.

Specified by:
isActive in interface ITrigger
Returns:
true if active

register

public abstract void register()
Called when the trigger is activated, e.g., if KIVi is (re-)activated or the first ICombination being fired by such a trigger is loaded. Registers itself where necessary.

Specified by:
register in interface ITrigger

unregister

public abstract void unregister()
Called when the trigger is deactivated, e.g., if the whole KIVi is deactivated. Unregisters itself where necessary.

Specified by:
unregister in interface ITrigger