import java.util.*;

public class Computer
{
    public Computer (boolean debug)
    {
        _debug = debug;
    }

    public int executeUntilInfiniteLoop (Vector<OpCode> instructions)
    {
        int index = 0;
        OpCode op = instructions.elementAt(index);
        int accumulator = 0;

        while (!op.visited())
        {
            if (_debug)
            {
                System.out.println("\nInstruction: "+index);
                System.out.println("Accumulator: "+accumulator+"\n");
            }

            switch (op.type())
            {
                case OpCode.ACCUMULATOR:
                {
                    int value = ((Accumulator) op).getValue();

                    if (_debug)
                        System.out.println("acc: adding "+value+" to accumulator "+accumulator);

                    accumulator += value;
                    index++;
                }
                break;
                case OpCode.JUMP:
                {
                    int value = ((Jump) op).getStep();

                    if (_debug)
                        System.out.println("jmp: adding "+value+" to index "+index);

                    index += ((Jump) op).getStep();
                }
                break;
                case OpCode.NOOP:
                default:
                {
                    // no op!!

                    if (_debug)
                        System.out.println("nop");

                    index++;
                }
                break;
            }

            op.visit();

            op = instructions.elementAt(index);
        }

        return accumulator;
    }

    private boolean _debug;
}
@@ -107,24 +107,1351 @@
 bug;%0A    %7D%0A%0A
+    public int executeUntilEnd (Vector%3COpCode%3E instructions)%0A    %7B%0A        int index = 0;%0A        OpCode op = instructions.elementAt(index);%0A        int accumulator = 0;%0A%0A        if (_debug)%0A        %7B%0A            System.out.println(%22%5CnInstruction: %22+index);%0A            System.out.println(%22Accumulator: %22+accumulator+%22%5Cn%22);%0A        %7D%0A%0A        switch (op.type())%0A        %7B%0A            case OpCode.ACCUMULATOR:%0A            %7B%0A                int value = ((Accumulator) op).getValue();%0A%0A                if (_debug)%0A                    System.out.println(%22acc: adding %22+value+%22 to accumulator %22+accumulator);%0A%0A                accumulator += value;%0A                index++;%0A            %7D%0A            break;%0A            case OpCode.JUMP:%0A            %7B%0A                int value = ((Jump) op).getStep();%0A%0A                if (_debug)%0A                    System.out.println(%22jmp: adding %22+value+%22 to index %22+index);%0A%0A                index += ((Jump) op).getStep();%0A            %7D%0A            break;%0A            case OpCode.NOOP:%0A            default:%0A            %7B%0A                // no op!!%0A%0A                if (_debug)%0A                    System.out.println(%22nop%22);%0A%0A                index++;%0A            %7D%0A            break;%0A        %7D%0A%0A        op.visit();%0A%0A        op = instructions.elementAt(index);%0A%0A        return accumulator;%0A    %7D%0A%0A
     public i

Update Computer.java