org.jactr.core.concurrent
Class ModelCycleExecutor

java.lang.Object
  extended by org.jactr.core.concurrent.ModelCycleExecutor
All Implemented Interfaces:
java.util.concurrent.Executor

public class ModelCycleExecutor
extends java.lang.Object
implements java.util.concurrent.Executor

model cycle executor allows you to execute runnable code either before or after any cycle.

Author:
harrison

Nested Class Summary
static class ModelCycleExecutor.When
           
 
Constructor Summary
ModelCycleExecutor(IModel model, ModelCycleExecutor.When when)
           
 
Method Summary
 void execute(java.lang.Runnable command)
          will call executeNow
 void executeAfterCycle(java.lang.Runnable command)
           
 void executeASAP(java.lang.Runnable command)
          attempts to queue this command to execute ASAP - if the model is mid-cycle, it will queue to execute after the cycle, otherwise, it will queue to execute before the next cycle.
 void executeBeforeCycle(java.lang.Runnable command)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelCycleExecutor

public ModelCycleExecutor(IModel model,
                          ModelCycleExecutor.When when)
Method Detail

execute

public void execute(java.lang.Runnable command)
will call executeNow

Specified by:
execute in interface java.util.concurrent.Executor

executeASAP

public void executeASAP(java.lang.Runnable command)
attempts to queue this command to execute ASAP - if the model is mid-cycle, it will queue to execute after the cycle, otherwise, it will queue to execute before the next cycle.

Parameters:
command -

executeBeforeCycle

public void executeBeforeCycle(java.lang.Runnable command)

executeAfterCycle

public void executeAfterCycle(java.lang.Runnable command)