# JAVA class translation 'COS_JRobo'
       # Thu Jun 30 17:00:24 EDT 2005
       # Produced by Fritzifier, based on JasminVisitor
       # Using BCEL library to read Java bytecode
       # Here is the original code:
       
       # import java.util.Iterator;
       
       # public class COS_JRobo extends COS_JThing {
       #     private COS_JHashMap times = new COS_JHashMap();
       #     private int now = 1;
       #     public void update() {
       #         COS_JRoom location = getRoom();
       #         //System.out.println("Updating robo...");
       #         if (location!=null) {
       #             int oldestTime = now;
       #             COS_JDoor oldestDoor = null;
       #             for (Iterator i = location.getDoors(); i.hasNext(); ) {
       #                 COS_JDoor door = (COS_JDoor) i.next();
       #                 //System.out.println(" scanning door ");
       #                 Integer t = (Integer)times.get(door);
       #                 int v = 0;
       #                 if (t!=null) {
       #                     v = t.intValue();
       #                 }
       #                 if (v<oldestTime) {
       #                     oldestTime = v;
       #                     oldestDoor = door;
       #                 }
       #             }
       #             if (oldestDoor!=null) {
       #                 times.put(oldestDoor,new Integer(now));
       #                 setNextRoom(oldestDoor.apply(location));
       #             }
       #         }
       #         now++;
       #     }
       # }
       
[hear] (class COS_JRobo ()
          (field super-ref (make-cell 0))
          (method new (set! (super-ref) ((COS_JThing) / this)))
          (method super (? x / (get! / super-ref) / x))
          (method unknown (? x / self super / x))
          (field times (cell new 0))
          (field now ((int) new))
          (method <init>-V
            (lambda () /
             let ((vars / cell new / make-hash / vector
                           (pair 0 (self)))
                  (stack / cell new / vector)) /
             state-machine (vars) (stack) / ? jvm / ? x / cond
                ((= (x) 0) (jvm aload 0))
                ((= (x) 1) (jvm invokespecial <init>-V 0 0))
                ((= (x) 2) (jvm aload 0))
                ((= (x) 3) (jvm new (COS_JHashMap)))
                ((= (x) 4) (jvm dup))
                ((= (x) 5) (jvm invokespecial <init>-V 0 0))
                ((= (x) 6) (jvm putfield times (COS_JHashMap)))
                ((= (x) 7) (jvm aload 0))
                ((= (x) 8) (jvm iconst 1))
                ((= (x) 9) (jvm putfield now (int)))
                ((= (x) 10) (jvm return))
                (jvm return))
          )
          (method <init> (self <init>-V))
          (method update-V
            (lambda () /
             let ((vars / cell new / make-hash / vector
                           (pair 0 (self)))
                  (stack / cell new / vector)) /
             state-machine (vars) (stack) / ? jvm / ? x / cond
                ((= (x) 0) (jvm aload 0))
                ((= (x) 1) (jvm invokevirtual getRoom-COS_JRoom 0 1))
                ((= (x) 2) (jvm astore 1))
                ((= (x) 3) (jvm aload 1))
                ((= (x) 4) (jvm ifnull 57))
                ((= (x) 5) (jvm aload 0))
                ((= (x) 6) (jvm getfield now (int)))
                ((= (x) 7) (jvm istore 2))
                ((= (x) 8) (jvm aconst_null))
                ((= (x) 9) (jvm astore 3))
                ((= (x) 10) (jvm aload 1))
                ((= (x) 11) (jvm invokevirtual getDoors-Iterator 0 1))
                ((= (x) 12) (jvm astore 4))
                ((= (x) 13) (jvm aload 4))
                ((= (x) 14) (jvm invokeinterface hasNext-Z 0 1 1))
                ((= (x) 15) (jvm ifeq 41))
                ((= (x) 16) (jvm aload 4))
                ((= (x) 17) (jvm invokeinterface next-Object 0 1 1))
                ((= (x) 18) (jvm checkcast (COS_JDoor)))
                ((= (x) 19) (jvm astore 5))
                ((= (x) 20) (jvm aload 0))
                ((= (x) 21) (jvm getfield times (COS_JHashMap)))
                ((= (x) 22) (jvm aload 5))
                ((= (x) 23) (jvm invokevirtual get-Object-Object 1 1))
                ((= (x) 24) (jvm checkcast (java lang Integer)))
                ((= (x) 25) (jvm astore 6))
                ((= (x) 26) (jvm iconst 0))
                ((= (x) 27) (jvm istore 7))
                ((= (x) 28) (jvm aload 6))
                ((= (x) 29) (jvm ifnull 33))
                ((= (x) 30) (jvm aload 6))
                ((= (x) 31) (jvm invokevirtual intValue-I 0 1))
                ((= (x) 32) (jvm istore 7))
                ((= (x) 33) (jvm iload 7))
                ((= (x) 34) (jvm iload 2))
                ((= (x) 35) (jvm if_icmpge 13))
                ((= (x) 36) (jvm iload 7))
                ((= (x) 37) (jvm istore 2))
                ((= (x) 38) (jvm aload 5))
                ((= (x) 39) (jvm astore 3))
                ((= (x) 40) (jvm goto 13))
                ((= (x) 41) (jvm aload 3))
                ((= (x) 42) (jvm ifnull 57))
                ((= (x) 43) (jvm aload 0))
                ((= (x) 44) (jvm getfield times (COS_JHashMap)))
                ((= (x) 45) (jvm aload 3))
                ((= (x) 46) (jvm new (java lang Integer)))
                ((= (x) 47) (jvm dup))
                ((= (x) 48) (jvm aload 0))
                ((= (x) 49) (jvm getfield now (int)))
                ((= (x) 50) (jvm invokespecial <init>-I-V 1 0))
                ((= (x) 51) (jvm invokevirtual put-Object-Object-V 2 0))
                ((= (x) 52) (jvm aload 0))
                ((= (x) 53) (jvm aload 3))
                ((= (x) 54) (jvm aload 1))
                ((= (x) 55) (jvm invokevirtual apply-COS_JRoom-COS_JRoom 1 1))
                ((= (x) 56) (jvm invokevirtual setNextRoom-COS_JRoom-V 1 0))
                ((= (x) 57) (jvm aload 0))
                ((= (x) 58) (jvm dup))
                ((= (x) 59) (jvm getfield now (int)))
                ((= (x) 60) (jvm iconst 1))
                ((= (x) 61) (jvm iadd))
                ((= (x) 62) (jvm putfield now (int)))
                ((= (x) 63) (jvm return))
                (jvm return))
          )
          (method update (self update-V))
        );