package v6.apps.zelvak;

import java.util.List;

public class Application {

	private final Command[] commands; // Arrays are probably more efficient than Lists.
	// It would be also great, if there was a bytecode compiler. This would not be much complicated if 
	// I had available BCEL (bytecode engineering library).
	// I'm not sure if Just-In-Time compiler can optimize these arrays.
	
	public Application(List<Command> commands) {
		this.commands = commands.toArray(new Command[0]);
	}

	public void run(RunningContext context) throws RunningException, InterruptedException {
		for (Command command : commands) {
			//System.out.println(command);
			command.execute(context);
		}
	}

}
