games.strategy.triplea.delegate
Class ExecutionStack

java.lang.Object
  extended by games.strategy.triplea.delegate.ExecutionStack
All Implemented Interfaces:
java.io.Serializable

public class ExecutionStack
extends java.lang.Object
implements java.io.Serializable

Utilility for tracking a sequence of executables. It works like this, We pop the top of the stack, store it in current, then execute it. While exececuting the current element, the current element can push more execution items onto the stack.

After execution has finished, we pop the next item, and execute it, repeating till nothing is left to exectue.

If an exception occurs during execution, we retain a reference to the current item. When we start executing again, we first push current onto the stack. In this way, an item may execute more than once. An IExecutable should be aware of this.

See Also:
Serialized Form

Constructor Summary
ExecutionStack()
           
 
Method Summary
 void execute(IDelegateBridge bridge, GameData data)
           
 boolean isEmpty()
           
 boolean isExecuting()
           
 void push(java.util.Collection<IExecutable> executables)
           
 void push(IExecutable executable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionStack

public ExecutionStack()
Method Detail

execute

public void execute(IDelegateBridge bridge,
                    GameData data)

push

public void push(java.util.Collection<IExecutable> executables)

push

public void push(IExecutable executable)

isExecuting

public boolean isExecuting()

isEmpty

public boolean isEmpty()