import java.util.*;

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

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

        _accumulator = 0;

        while (!op.visited())
        {
            if (_debug)
                System.out.println("Executing: "+op);

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

                    if (_debug)
                        System.out.println("Adding "+value+" to accumulator "+_accumulator);

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

                    if (_debug)
                        System.out.println("Adding "+value+" to index "+index);

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

            index++;

            op.visit();

            op = instructions.elementAt(index);
        }

        return _accumulator;
    }

    private int _accumulator;
    private boolean _debug;
}
@@ -319,52 +319,8 @@
 0;%0A%0A
-        while (!op.visited())%0A        %7B%0A    
     
@@ -327,36 +327,32 @@
     if (_debug)%0A
-    
             Syst
@@ -370,27 +370,63 @@
 tln(
-%22Executing: %22+op);%0A
+);%0A            %0A        while (!op.visited())%0A        %7B
 %0A   
@@ -658,33 +658,38 @@
 em.out.println(%22
-A
+acc: a
 dding %22+value+%22 
@@ -989,17 +989,22 @@
 rintln(%22
-A
+jmp: a
 dding %22+
@@ -1231,16 +1231,100 @@
  no op!!
+%0A%0A                    if (_debug)%0A                        System.out.println(%22nop%22);
 %0A       

Update Computer.java