Hello I am trying to build a framework of IAction objects that will execute in a sequence. Each IAction implementation will execute its processAction() method as it was implemented for. This method returns a IAction, which in most cases is itself, but in some cases may be a pointer to another IAction in the List. The IActionIterator interface is created to manage that movement in the List. Here is the interface
public interface IAction {
public IAction processAction();
}
pulbic interface IActionIterator {
public IAction getFirstAction();
public IAction getNextAction( IAction action );
}
My framework will obtain a List and will loop thru the list executing the processAction() of each IAction class. Here is what the loop will look like
IActionIterator iter = ... // created some how
IAction action = iter.getFirstAction();
do {
IAction newAction = action.processAction();
if( action.equals( newAction )
action = iter.getNextAction( action );
else
action = newAction;
while( action != null ) {
So each IAction has its implementation to execute and some IAction have business logic that will return an IAction in the list instead of executing the next one in the list.
I am anticipating some IAction classes that will execute, but the next IAction in the list will need the results from the first. For example one of the IAction is executing an SQL query and the results are pertinent to the next IAction in the list.
So my question is how would or should I implement this in information passing form IAction to IAction in my designed Framework?