/*****************************************************
 * jr generated file
 ****************************************************/
import edu.ucdavis.jr.*;
import edu.ucdavis.jr.jrx.*;
import java.rmi.*;
import java.io.Serializable;


public class main extends java.lang.Object {
    { JRinit(); }
    
    public main() {
        // Begin Expr2
        super();
        JRprocess();
    }
    
    public static void runvoidTovoidThrowsjavadotlangdotNullPointerException(java.lang.Object [] JRargs) throws NullPointerException {
        ((Op_ext_ThrowsjavadotlangdotNullPointerException.JRProxyOp)op_run_voidTovoidThrowsjavadotlangdotNullPointerException).call(jrvm.getTimestamp(), JRargs);
    }
    private static void runvoidTovoidThrowsjavadotlangdotNullPointerException(Op_ext.JRProxyOp retOp, Cap_ext fretOp, edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs) throws NullPointerException
    {
        try    {
            {
                InStatObj JRInstmt0 = new InStatObj(5, false);
                CoStatObj JRCostmt0 = new CoStatObj(4, new boolean [] {false, false, false, false});
                // costmt without quantifier
                int JR_co_0_totalInvs = 0;

                // intialize fretop for each costmt
                JRCostmt0.JR_co_fretop_voidTovoid = new Cap_ext_(new Op_ext_.JRProxyOp(InOp_ext_impl.create()), "void");

                // setting up cocall / cosend and return operations for regular co arm #: 0
                int JR_co_0_0_count = 0;
                int JR_co_0_0_totalArms = 0;
                JR_co_0_totalInvs++;
                JRCostmt0.JR_co_retop[0][0] = (new Cap_ext_(JRget_op_GO_intTojavadotlangdotString(), "java.lang.String")).cocall(jrvm.getTimestamp(), (edu.ucdavis.jr.RemoteHandler) null, (Cap_ext)JRCostmt0.JR_co_fretop_voidTovoid, new java.lang.Object [] {1});

                // setting up cocall / cosend and return operations for regular co arm #: 1
                int JR_co_0_1_count = 0;
                int JR_co_0_1_totalArms = 0;
                JR_co_0_totalInvs++;
                JRCostmt0.JR_co_retop[1][0] = (new Cap_ext_(JRget_op_GO_intTojavadotlangdotString(), "java.lang.String")).cocall(jrvm.getTimestamp(), (edu.ucdavis.jr.RemoteHandler) null, (Cap_ext)JRCostmt0.JR_co_fretop_voidTovoid, new java.lang.Object [] {2});

                // setting up cocall / cosend and return operations for regular co arm #: 2
                int JR_co_0_2_count = 0;
                int JR_co_0_2_totalArms = 0;
                JR_co_0_totalInvs++;
                JRCostmt0.JR_co_retop[2][0] = (new Cap_ext_(JRget_op_GO_intTojavadotlangdotString(), "java.lang.String")).cocall(jrvm.getTimestamp(), (edu.ucdavis.jr.RemoteHandler) null, (Cap_ext)JRCostmt0.JR_co_fretop_voidTovoid, new java.lang.Object [] {3});

                // setting up cocall / cosend and return operations for regular co arm #: 3
                int JR_co_0_3_count = 0;
                int JR_co_0_3_totalArms = 0;
                JR_co_0_totalInvs++;
                JRCostmt0.JR_co_retop[3][0] = (new Cap_ext_(JRget_op_GO_intTojavadotlangdotString(), "java.lang.String")).cocall(jrvm.getTimestamp(), (edu.ucdavis.jr.RemoteHandler) null, (Cap_ext)JRCostmt0.JR_co_fretop_voidTovoid, new java.lang.Object [] {4});

                // inni for costmt
                JRLoop0:for (int JR_CO_COUNT_0 = 0; JR_CO_COUNT_0 < 4; JR_CO_COUNT_0++) {
                {
                    // Inni Statement without quantifier
                    JRInstmt0.armArray[0] = new QuantRec(JRCostmt0.JR_co_retop[0][0], 0, 0);
                    JRInstmt0.armArray[1] = new QuantRec(JRCostmt0.JR_co_retop[1][0], 1, 1);
                    JRInstmt0.armArray[2] = new QuantRec(JRCostmt0.JR_co_retop[2][0], 2, 2);
                    JRInstmt0.armArray[3] = new QuantRec(JRCostmt0.JR_co_retop[3][0], 3, 3);
                    JRInstmt0.armArray[4] = new QuantRec(JRCostmt0.JR_co_fretop_voidTovoid, 4, 4);
                    JRInstmt0.lock();
                    // Equivalence Class has been created and locked
                    JRInstmt0.serviced = false;
                    _label_JRInstmt0: do
                    {
                        Invocation JRfinalInvoc0 = null;
                        // find THE invocation and service it
                        JRInstmt0.gatherAndSortTimes();
                        for (JRInstmt0.i = 0;
                            (JRInstmt0.i < JRInstmt0.N) && !JRInstmt0.serviced;
                             JRInstmt0.i++)
                        {
                            JRInstmt0.byStrt = true;
                            JRInstmt0.releaseIter();
                            // if the op is empty
                            if (JRInstmt0.timesArray[JRInstmt0.i].time < 0) continue;
                            switch (JRInstmt0.timesArray[JRInstmt0.i].opNum)
                            {
                                case 0:
                                {
                                    JRInstmt0.j = 0;
                                    // Inni Arm
                                    QuantRec JRquantRec0 = (QuantRec)JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex];
                                    Recv_ext JRrrecv0 = null, JRtmprecv0;
                                    
                                    for (JRInstmt0.iter = JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex].theCap.elements();
                                         JRInstmt0.iter.hasNext();)
                                    {
                                        JRtmprecv0 = (Recv_ext)JRInstmt0.iter.next();
                                        JRInstmt0.JRinit.setInvoc(JRInstmt0.j++);
                                        JRtmprecv0.setInvocation(JRInstmt0.JRinit);
                                        // extract values
                                        JRrrecv0 = JRtmprecv0;
                                        break;  // get first one
                                    }
                                    // Start of servicing
                                    if (JRrrecv0 != null)
                                    {
                                        JRInstmt0.j = (int)JRrrecv0.getInvoc();
                                        JRInstmt0.serviced = true;
                                        JRInstmt0.iter.remove(JRInstmt0.j);
                                        JRInstmt0.releaseIter();
                                        JRInstmt0.unlock();
                                        {
                                            try {
                                                {
                                                    // Begin Expr2
                                                    System.out.println("ppc1");
                                                }
                                            } catch (Exception JRe) {
                                                if (JRrrecv0.retOp != null && JRrrecv0.fretOp == null)
                                                {
                                                    // forward of cocall
                                                    if ((JRrrecv0.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                        JRrrecv0.handler.JRhandler(JRe);
                                                    else {
                                                        // give preference to propagation through the call stack
                                                        JRrrecv0.retOp.send(jrvm.getTimestamp(), JRe);
                                                        JRrrecv0.retOp = null;
                                                    }
                                                }
                                                else if ((JRrrecv0.retOp != null) && (JRrrecv0.fretOp != null) && !(JRe instanceof java.rmi.RemoteException))
                                                {
                                                    // for cocall exception handling in operation invocation
                                                    if (JRrrecv0.handler != null)
                                                        JRrrecv0.handler.JRhandler(JRe);
                                                    JRrrecv0.fretOp.send(jrvm.getTimestamp(), JRrrecv0.handler, (java.lang.Object []) null);
                                                    JRrrecv0.fretOp = null;
                                                }
                                                else if ((JRrrecv0.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                {
                                                    // this should only be a send
                                                    JRrrecv0.handler.JRhandler(JRe);
                                                }
                                            }
                                        }
                                        
                                    }
                                    else
                                        JRInstmt0.releaseIter();
                                    // End of servicing
                                    // End InniArm
                                    break;
                                }
                                case 1:
                                {
                                    JRInstmt0.j = 0;
                                    // Inni Arm
                                    QuantRec JRquantRec0 = (QuantRec)JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex];
                                    Recv_ext JRrrecv0 = null, JRtmprecv0;
                                    
                                    for (JRInstmt0.iter = JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex].theCap.elements();
                                         JRInstmt0.iter.hasNext();)
                                    {
                                        JRtmprecv0 = (Recv_ext)JRInstmt0.iter.next();
                                        JRInstmt0.JRinit.setInvoc(JRInstmt0.j++);
                                        JRtmprecv0.setInvocation(JRInstmt0.JRinit);
                                        // extract values
                                        JRrrecv0 = JRtmprecv0;
                                        break;  // get first one
                                    }
                                    // Start of servicing
                                    if (JRrrecv0 != null)
                                    {
                                        JRInstmt0.j = (int)JRrrecv0.getInvoc();
                                        JRInstmt0.serviced = true;
                                        JRInstmt0.iter.remove(JRInstmt0.j);
                                        JRInstmt0.releaseIter();
                                        JRInstmt0.unlock();
                                        {
                                            try {
                                                {
                                                    // Begin Expr2
                                                    System.out.println("ppc2");
                                                    throw new NullPointerException();
                                                }
                                            } catch (Exception JRe) {
                                                if (JRrrecv0.retOp != null && JRrrecv0.fretOp == null)
                                                {
                                                    // forward of cocall
                                                    if ((JRrrecv0.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                        JRrrecv0.handler.JRhandler(JRe);
                                                    else {
                                                        // give preference to propagation through the call stack
                                                        JRrrecv0.retOp.send(jrvm.getTimestamp(), JRe);
                                                        JRrrecv0.retOp = null;
                                                    }
                                                }
                                                else if ((JRrrecv0.retOp != null) && (JRrrecv0.fretOp != null) && !(JRe instanceof java.rmi.RemoteException))
                                                {
                                                    // for cocall exception handling in operation invocation
                                                    if (JRrrecv0.handler != null)
                                                        JRrrecv0.handler.JRhandler(JRe);
                                                    JRrrecv0.fretOp.send(jrvm.getTimestamp(), JRrrecv0.handler, (java.lang.Object []) null);
                                                    JRrrecv0.fretOp = null;
                                                }
                                                else if ((JRrrecv0.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                {
                                                    // this should only be a send
                                                    JRrrecv0.handler.JRhandler(JRe);
                                                }
                                                else {
                                                    // for COSTMT exception handling in ppc
                                                    if (JRe instanceof java.lang.RuntimeException)
                                                        throw (java.lang.RuntimeException)JRe;
                                                    }
                                                }
                                            }
                                            
                                        }
                                        else
                                            JRInstmt0.releaseIter();
                                        // End of servicing
                                        // End InniArm
                                        break;
                                    }
                                    case 2:
                                    {
                                        JRInstmt0.j = 0;
                                        // Inni Arm
                                        QuantRec JRquantRec0 = (QuantRec)JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex];
                                        Recv_ext JRrrecv0 = null, JRtmprecv0;
                                        
                                        for (JRInstmt0.iter = JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex].theCap.elements();
                                             JRInstmt0.iter.hasNext();)
                                        {
                                            JRtmprecv0 = (Recv_ext)JRInstmt0.iter.next();
                                            JRInstmt0.JRinit.setInvoc(JRInstmt0.j++);
                                            JRtmprecv0.setInvocation(JRInstmt0.JRinit);
                                            // extract values
                                            JRrrecv0 = JRtmprecv0;
                                            break;  // get first one
                                        }
                                        // Start of servicing
                                        if (JRrrecv0 != null)
                                        {
                                            JRInstmt0.j = (int)JRrrecv0.getInvoc();
                                            JRInstmt0.serviced = true;
                                            JRInstmt0.iter.remove(JRInstmt0.j);
                                            JRInstmt0.releaseIter();
                                            JRInstmt0.unlock();
                                            {
                                                try {
                                                    {
                                                        // Begin Expr2
                                                        System.out.println("ppc3");
                                                    }
                                                } catch (Exception JRe) {
                                                    if (JRrrecv0.retOp != null && JRrrecv0.fretOp == null)
                                                    {
                                                        // forward of cocall
                                                        if ((JRrrecv0.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                            JRrrecv0.handler.JRhandler(JRe);
                                                        else {
                                                            // give preference to propagation through the call stack
                                                            JRrrecv0.retOp.send(jrvm.getTimestamp(), JRe);
                                                            JRrrecv0.retOp = null;
                                                        }
                                                    }
                                                    else if ((JRrrecv0.retOp != null) && (JRrrecv0.fretOp != null) && !(JRe instanceof java.rmi.RemoteException))
                                                    {
                                                        // for cocall exception handling in operation invocation
                                                        if (JRrrecv0.handler != null)
                                                            JRrrecv0.handler.JRhandler(JRe);
                                                        JRrrecv0.fretOp.send(jrvm.getTimestamp(), JRrrecv0.handler, (java.lang.Object []) null);
                                                        JRrrecv0.fretOp = null;
                                                    }
                                                    else if ((JRrrecv0.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                    {
                                                        // this should only be a send
                                                        JRrrecv0.handler.JRhandler(JRe);
                                                    }
                                                }
                                            }
                                            
                                        }
                                        else
                                            JRInstmt0.releaseIter();
                                        // End of servicing
                                        // End InniArm
                                        break;
                                    }
                                    case 3:
                                    {
                                        JRInstmt0.j = 0;
                                        // Inni Arm
                                        QuantRec JRquantRec0 = (QuantRec)JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex];
                                        Recv_ext JRrrecv0 = null, JRtmprecv0;
                                        
                                        for (JRInstmt0.iter = JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex].theCap.elements();
                                             JRInstmt0.iter.hasNext();)
                                        {
                                            JRtmprecv0 = (Recv_ext)JRInstmt0.iter.next();
                                            JRInstmt0.JRinit.setInvoc(JRInstmt0.j++);
                                            JRtmprecv0.setInvocation(JRInstmt0.JRinit);
                                            // extract values
                                            JRrrecv0 = JRtmprecv0;
                                            break;  // get first one
                                        }
                                        // Start of servicing
                                        if (JRrrecv0 != null)
                                        {
                                            JRInstmt0.j = (int)JRrrecv0.getInvoc();
                                            JRInstmt0.serviced = true;
                                            JRInstmt0.iter.remove(JRInstmt0.j);
                                            JRInstmt0.releaseIter();
                                            JRInstmt0.unlock();
                                            {
                                                try {
                                                    {
                                                        // Begin Expr2
                                                        System.out.println("ppc4");
                                                    }
                                                } catch (Exception JRe) {
                                                    if (JRrrecv0.retOp != null && JRrrecv0.fretOp == null)
                                                    {
                                                        // forward of cocall
                                                        if ((JRrrecv0.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                            JRrrecv0.handler.JRhandler(JRe);
                                                        else {
                                                            // give preference to propagation through the call stack
                                                            JRrrecv0.retOp.send(jrvm.getTimestamp(), JRe);
                                                            JRrrecv0.retOp = null;
                                                        }
                                                    }
                                                    else if ((JRrrecv0.retOp != null) && (JRrrecv0.fretOp != null) && !(JRe instanceof java.rmi.RemoteException))
                                                    {
                                                        // for cocall exception handling in operation invocation
                                                        if (JRrrecv0.handler != null)
                                                            JRrrecv0.handler.JRhandler(JRe);
                                                        JRrrecv0.fretOp.send(jrvm.getTimestamp(), JRrrecv0.handler, (java.lang.Object []) null);
                                                        JRrrecv0.fretOp = null;
                                                    }
                                                    else if ((JRrrecv0.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                    {
                                                        // this should only be a send
                                                        JRrrecv0.handler.JRhandler(JRe);
                                                    }
                                                }
                                            }
                                            
                                        }
                                        else
                                            JRInstmt0.releaseIter();
                                        // End of servicing
                                        // End InniArm
                                        break;
                                    }
                                    case 4:
                                    {
                                        JRInstmt0.j = 0;
                                        // Inni Arm
                                        QuantRec JRquantRec0 = (QuantRec)JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex];
                                        Recv_ext JRrrecv0 = null, JRtmprecv0;
                                        for (JRInstmt0.iter = JRInstmt0.armArray[JRInstmt0.timesArray[JRInstmt0.i].armArrayIndex].theCap.elements();
                                             JRInstmt0.iter.hasNext();)
                                        {
                                            JRtmprecv0 = (Recv_ext)JRInstmt0.iter.next();
                                            JRInstmt0.JRinit.setInvoc(JRInstmt0.j++);
                                            JRtmprecv0.setInvocation(JRInstmt0.JRinit);
                                            // extract values
                                            JRrrecv0 = JRtmprecv0;
                                            break;  // get first one
                                        }
                                        // Start of servicing
                                        if (JRrrecv0 != null)
                                        {
                                            JRInstmt0.j = (int)JRrrecv0.getInvoc();
                                            JRInstmt0.serviced = true;
                                            JRInstmt0.iter.remove(JRInstmt0.j);
                                            JRInstmt0.releaseIter();
                                            JRInstmt0.unlock();
                                            
                                        }
                                        else
                                            JRInstmt0.releaseIter();
                                        // End of servicing
                                        // End InniArm
                                        break;
                                    }
                                    
                                }
                            }
                            if (!JRInstmt0.serviced)
                            {
                                // must block and loop
                                JRInstmt0.waitOnLock();
                            }
                        } while (!JRInstmt0.serviced);
                    }
                    // End Inni
                    }
                    
                    // Return
                    { if (retOp != null)
                        retOp.send(jrvm.getTimestamp(), (edu.ucdavis.jr.RemoteHandler) null, null);
                    return ; }
                    // End Return

                }
            } catch (Exception JRe)    {
                if (retOp != null && fretOp == null)
                {
            	// if it is a forward cocall with handler
            	if ((handler != null) && !(JRe instanceof java.rmi.RemoteException))
            	    handler.JRhandler(JRe);
            	else
            	    // give preference to propagation through the call stack
            	    retOp.send(jrvm.getTimestamp(), JRe);
                }
                else if ((retOp != null) && (fretOp != null) && !(JRe instanceof java.rmi.RemoteException))
                {
            	// for COSTMT exception handling in operation
            	if (handler != null)
            	    handler.JRhandler(JRe);
            	fretOp.send(jrvm.getTimestamp(), handler, (java.lang.Object []) null);
                }
                else if ((handler != null) && !(JRe instanceof java.rmi.RemoteException))
                {
            	// this should only be for a send/forward
            	handler.JRhandler(JRe);
            	// can rethrow below just to get out of this method
                }
                // rethrow the proper type of exception
                if (JRe instanceof java.lang.NullPointerException) throw (java.lang.NullPointerException) JRe;
                // catch all
                throw new jrRuntimeError("Unhandled exception: " + JRe.toString());
            }
        }
        public static Op_ext.JRProxyOp JRget_op_run_voidTovoidThrowsjavadotlangdotNullPointerException()
        {
            return op_run_voidTovoidThrowsjavadotlangdotNullPointerException;
        }
        
        public static Op_ext.JRProxyOp op_run_voidTovoidThrowsjavadotlangdotNullPointerException;
        static class ProcOp_voidTovoidThrowsjavadotlangdotNullPointerException_implrun extends ProcOp_ext_impl
        {
            public ProcOp_voidTovoidThrowsjavadotlangdotNullPointerException_implrun(main thisIn) throws RemoteException
            {
            }
            public java.lang.Object call(long JRtimestamp, java.lang.Object [] JRargs) throws RemoteException, java.lang.NullPointerException
            {
                jrvm.ariseAndReceive();  // from caller
                try    {
                    jrvm.setTimestamp(JRtimestamp);
                    main.runvoidTovoidThrowsjavadotlangdotNullPointerException(null, null, null, JRargs);
return null;
                } finally {
                    jrvm.sendAndDie();    // to caller
                }
            }
            class sendThread implements Runnable
            {
                java.lang.Object [] JRargs;
                Op_ext.JRProxyOp retOp;
                Cap_ext fretOp;
                edu.ucdavis.jr.RemoteHandler handler;

                public sendThread(Op_ext.JRProxyOp retOp, edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs)
                {
                    this.JRargs = JRargs;
                    this.retOp = retOp;
                    this.handler = handler;
                }
                public sendThread(Op_ext.JRProxyOp retOp, Cap_ext fretOp,edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs)
                {
                    this.JRargs = JRargs;
                    this.retOp = retOp;
                    this.fretOp = fretOp;
                    this.handler = handler;
                }
                public void run()
                {
                    try    {
                        main.runvoidTovoidThrowsjavadotlangdotNullPointerException(this.retOp, this.fretOp, this.handler, this.JRargs);
                    } catch (Exception e) {/* should be safe to ignore this exception */}
                    jrvm.threadDeath();
                }
            }
            public void send(long JRtimestamp, java.lang.Object [] JRargs) throws RemoteException
            {
                this.send(JRtimestamp, null, null, null, JRargs);
            }
            public Cap_ext cosend(long JRtimestamp, java.lang.Object [] JRargs) throws RemoteException
            {
                return this.cosend(JRtimestamp, null, null, null, JRargs);
            }
            public void send(long JRtimestamp, edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs) throws RemoteException
            {
                this.send(JRtimestamp, null, handler, null, JRargs);
            }
            public Cap_ext cosend(long JRtimestamp, edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs) throws RemoteException
            {
                return this.cosend(JRtimestamp, null, handler, null, JRargs);
            }
            public void send(long JRtimestamp, Op_ext.JRProxyOp retOp, edu.ucdavis.jr.RemoteHandler handler, Exception thrown, java.lang.Object [] JRargs) throws RemoteException
            {
                jrvm.setTimestamp(JRtimestamp);
                jrvm.threadBirth();
                new Thread(new sendThread(retOp, handler, JRargs)).start();
            }
            public Cap_ext cosend(long JRtimestamp, Op_ext.JRProxyOp retOp, edu.ucdavis.jr.RemoteHandler handler, Exception thrown, java.lang.Object [] JRargs) throws RemoteException
            {
                jrvm.setTimestamp(JRtimestamp);
                jrvm.threadBirth();
                new Thread(new sendThread(null, handler, JRargs)).start();
                Op_ext.JRProxyOp myretOp = new Op_ext_ThrowsjavadotlangdotNullPointerException.JRProxyOp(new InOp_ext_impl());
                myretOp.send(jrvm.getTimestamp(), (java.lang.Object []) null);
                return new Cap_ext_ThrowsjavadotlangdotNullPointerException(myretOp, "void");
            }
            public Cap_ext cocall(long JRtimestamp, java.lang.Object [] JRargs) throws RemoteException, java.lang.NullPointerException
            {
                Op_ext.JRProxyOp retOp = new Op_ext_ThrowsjavadotlangdotNullPointerException.JRProxyOp(new InOp_ext_impl(false));
                jrvm.setTimestamp(JRtimestamp);
                jrvm.threadBirth();
                new Thread(new sendThread(retOp, null, JRargs)).start();
                Cap_ext retCap = new Cap_ext_ThrowsjavadotlangdotNullPointerException(retOp, "void");
                return retCap;
            }
            public Cap_ext cocall(long JRtimestamp, edu.ucdavis.jr.RemoteHandler handler, Cap_ext fretOp, java.lang.Object [] JRargs) throws RemoteException
            {
                Op_ext.JRProxyOp retOp = new Op_ext_ThrowsjavadotlangdotNullPointerException.JRProxyOp(new InOp_ext_impl(false));
                jrvm.setTimestamp(JRtimestamp);
                jrvm.threadBirth();
                new Thread(new sendThread(retOp, fretOp, handler, JRargs)).start();
                Cap_ext retCap = new Cap_ext_ThrowsjavadotlangdotNullPointerException(retOp, "void");
                return retCap;
            }
            public Recv_ext recv() throws RemoteException
            {
                /* This is an error */
                throw new jrRuntimeError("Receive invoked on an operation/operation capability associated with a method!");
            }
            public void deliverPendingMessages()
            {
                /* This is an error */
                throw new jrRuntimeError("Message delivery invoked on an operation associated with a method!");
            }
            public int length()
            {
                return 0;
            }
            public InOpIterator elements()
            {
                // This is an error
                throw new jrRuntimeError("Elements invoked on an operation / operation capability associated with a method!");
            }
            public InLock getLock()
            {
                // This is an error
                throw new jrRuntimeError("getLock invoked on an operation / operation capability associated with a method!");
            }
            public long getFirstTime()
            {
                // This is an error
                throw new jrRuntimeError("getFirstTime invoked on an operation / operation capability associated with a method!");
            }
            public boolean isRemote(String site)
            {
                // This is an error
                throw new jrRuntimeError("IsRemote invoked on an operation / operation capability associated with a method!");
            }
        }
        ;
        static    {
            try    {
                op_run_voidTovoidThrowsjavadotlangdotNullPointerException = new Op_ext_ThrowsjavadotlangdotNullPointerException.JRProxyOp(new ProcOp_voidTovoidThrowsjavadotlangdotNullPointerException_implrun(null));
            } catch (Exception e) { throw new jrRuntimeError(e.toString());}
        }
        
        
        public static void main(String[] args) {
            try {
                // Begin Expr2
                (new Cap_ext_ThrowsjavadotlangdotNullPointerException(JRget_op_run_voidTovoidThrowsjavadotlangdotNullPointerException(), "void")).call(jrvm.getTimestamp(), (java.lang.Object[]) null);
            } catch (java.lang.Exception e) {
                // Begin Expr2
                System.err.println("Oops.  The JR world isn\'t so wonderful ;-(");
            }
            // Begin Expr2
            System.out.println("After co");
        }
        private static Op_ext.JRProxyOp JRget_op_GO_intTojavadotlangdotString()
        {
            return op_GO_intTojavadotlangdotString;
        }
        
        public static Op_ext.JRProxyOp op_GO_intTojavadotlangdotString;
        ;
        static    {
            try    {
                op_GO_intTojavadotlangdotString = new Op_ext_.JRProxyOp(new InOp_ext_impl());
            } catch (Exception e) { throw new jrRuntimeError(e.toString());}
        }
        
        private static Op_ext.JRProxyOp JRget_op_MYPROCESS_voidTovoid()
        {
            return op_MYPROCESS_voidTovoid;
        }
        
        public static Op_ext.JRProxyOp op_MYPROCESS_voidTovoid;
        static class ProcOp_voidTovoid_implMYPROCESS extends ProcOp_ext_impl
        {
            public ProcOp_voidTovoid_implMYPROCESS(main thisIn) throws RemoteException
            {
            }
            public java.lang.Object call(long JRtimestamp, java.lang.Object [] JRargs) throws RemoteException
            {
                jrvm.ariseAndReceive();  // from caller
                try    {
                    jrvm.setTimestamp(JRtimestamp);
                    main.MYPROCESSvoidTovoid(null, null, null, JRargs);
return null;
                } finally {
                    jrvm.sendAndDie();    // to caller
                }
            }
            class sendThread implements Runnable
            {
                java.lang.Object [] JRargs;
                Op_ext.JRProxyOp retOp;
                Cap_ext fretOp;
                edu.ucdavis.jr.RemoteHandler handler;

                public sendThread(Op_ext.JRProxyOp retOp, edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs)
                {
                    this.JRargs = JRargs;
                    this.retOp = retOp;
                    this.handler = handler;
                }
                public sendThread(Op_ext.JRProxyOp retOp, Cap_ext fretOp,edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs)
                {
                    this.JRargs = JRargs;
                    this.retOp = retOp;
                    this.fretOp = fretOp;
                    this.handler = handler;
                }
                public void run()
                {
                    try    {
                        main.MYPROCESSvoidTovoid(this.retOp, this.fretOp, this.handler, this.JRargs);
                    } catch (Exception e) {/* should be safe to ignore this exception */}
                    jrvm.threadDeath();
                }
            }
            public void send(long JRtimestamp, java.lang.Object [] JRargs) throws RemoteException
            {
                this.send(JRtimestamp, null, null, null, JRargs);
            }
            public Cap_ext cosend(long JRtimestamp, java.lang.Object [] JRargs) throws RemoteException
            {
                return this.cosend(JRtimestamp, null, null, null, JRargs);
            }
            public void send(long JRtimestamp, edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs) throws RemoteException
            {
                this.send(JRtimestamp, null, handler, null, JRargs);
            }
            public Cap_ext cosend(long JRtimestamp, edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs) throws RemoteException
            {
                return this.cosend(JRtimestamp, null, handler, null, JRargs);
            }
            public void send(long JRtimestamp, Op_ext.JRProxyOp retOp, edu.ucdavis.jr.RemoteHandler handler, Exception thrown, java.lang.Object [] JRargs) throws RemoteException
            {
                jrvm.setTimestamp(JRtimestamp);
                jrvm.threadBirth();
                new Thread(new sendThread(retOp, handler, JRargs)).start();
            }
            public Cap_ext cosend(long JRtimestamp, Op_ext.JRProxyOp retOp, edu.ucdavis.jr.RemoteHandler handler, Exception thrown, java.lang.Object [] JRargs) throws RemoteException
            {
                jrvm.setTimestamp(JRtimestamp);
                jrvm.threadBirth();
                new Thread(new sendThread(null, handler, JRargs)).start();
                Op_ext.JRProxyOp myretOp = new Op_ext_.JRProxyOp(new InOp_ext_impl());
                myretOp.send(jrvm.getTimestamp(), (java.lang.Object []) null);
                return new Cap_ext_(myretOp, "void");
            }
            public Cap_ext cocall(long JRtimestamp, java.lang.Object [] JRargs) throws RemoteException
            {
                Op_ext.JRProxyOp retOp = new Op_ext_.JRProxyOp(new InOp_ext_impl(false));
                jrvm.setTimestamp(JRtimestamp);
                jrvm.threadBirth();
                new Thread(new sendThread(retOp, null, JRargs)).start();
                Cap_ext retCap = new Cap_ext_(retOp, "void");
                return retCap;
            }
            public Cap_ext cocall(long JRtimestamp, edu.ucdavis.jr.RemoteHandler handler, Cap_ext fretOp, java.lang.Object [] JRargs) throws RemoteException
            {
                Op_ext.JRProxyOp retOp = new Op_ext_.JRProxyOp(new InOp_ext_impl(false));
                jrvm.setTimestamp(JRtimestamp);
                jrvm.threadBirth();
                new Thread(new sendThread(retOp, fretOp, handler, JRargs)).start();
                Cap_ext retCap = new Cap_ext_(retOp, "void");
                return retCap;
            }
            public Recv_ext recv() throws RemoteException
            {
                /* This is an error */
                throw new jrRuntimeError("Receive invoked on an operation/operation capability associated with a method!");
            }
            public void deliverPendingMessages()
            {
                /* This is an error */
                throw new jrRuntimeError("Message delivery invoked on an operation associated with a method!");
            }
            public int length()
            {
                return 0;
            }
            public InOpIterator elements()
            {
                // This is an error
                throw new jrRuntimeError("Elements invoked on an operation / operation capability associated with a method!");
            }
            public InLock getLock()
            {
                // This is an error
                throw new jrRuntimeError("getLock invoked on an operation / operation capability associated with a method!");
            }
            public long getFirstTime()
            {
                // This is an error
                throw new jrRuntimeError("getFirstTime invoked on an operation / operation capability associated with a method!");
            }
            public boolean isRemote(String site)
            {
                // This is an error
                throw new jrRuntimeError("IsRemote invoked on an operation / operation capability associated with a method!");
            }
        }
        ;
        static    {
            try    {
                op_MYPROCESS_voidTovoid = new Op_ext_.JRProxyOp(new ProcOp_voidTovoid_implMYPROCESS(null));
            } catch (Exception e) { throw new jrRuntimeError(e.toString());}
        }
        
        private static void MYPROCESSvoidTovoid(java.lang.Object [] JRargs) {
            ((Op_ext_.JRProxyOp)op_MYPROCESS_voidTovoid).call(jrvm.getTimestamp(), JRargs);
        }
        private static void MYPROCESSvoidTovoid(Op_ext.JRProxyOp retOp, Cap_ext fretOp, edu.ucdavis.jr.RemoteHandler handler, java.lang.Object [] JRargs)
        {
            try    {
                {
                    InStatObj JRInstmt1 = new InStatObj(1, false);
                    int n = 1;
                    JRLoop1: while (true) {
                        {
                            // Inni Statement without quantifier
                            JRInstmt1.armArray[0] = new QuantRec(new Cap_ext_(op_GO_intTojavadotlangdotString, "java.lang.String"), 0, 0);
                            JRInstmt1.lock();
                            // Equivalence Class has been created and locked
                            JRInstmt1.serviced = false;
                            _label_JRInstmt1: do
                            {
                                Invocation JRfinalInvoc1 = null;
                                // find THE invocation and service it
                                JRInstmt1.gatherAndSortTimes();
                                for (JRInstmt1.i = 0;
                                    (JRInstmt1.i < JRInstmt1.N) && !JRInstmt1.serviced;
                                     JRInstmt1.i++)
                                {
                                    JRInstmt1.byStrt = true;
                                    JRInstmt1.releaseIter();
                                    // if the op is empty
                                    if (JRInstmt1.timesArray[JRInstmt1.i].time < 0) continue;
                                    switch (JRInstmt1.timesArray[JRInstmt1.i].opNum)
                                    {
                                        case 0:
                                        {
                                            JRInstmt1.j = 0;
                                            // Inni Arm
                                            QuantRec JRquantRec1 = (QuantRec)JRInstmt1.armArray[JRInstmt1.timesArray[JRInstmt1.i].armArrayIndex];
                                            Recv_ext JRrrecv1 = null, JRtmprecv1;
                                            int x = 0;
                                            for (JRInstmt1.iter = JRInstmt1.armArray[JRInstmt1.timesArray[JRInstmt1.i].armArrayIndex].theCap.elements();
                                                 JRInstmt1.iter.hasNext();)
                                            {
                                                JRtmprecv1 = (Recv_ext)JRInstmt1.iter.next();
                                                JRInstmt1.JRinit.setInvoc(JRInstmt1.j++);
                                                JRtmprecv1.setInvocation(JRInstmt1.JRinit);
                                                // extract values
                                                // GetMethod 2
                                                x = ((Number) JRtmprecv1.JRargs[0]).intValue();
                                                ;
                                                if (x == n)
                                                    JRrrecv1 = JRtmprecv1;
                                                if (JRrrecv1 != null)
                                                    break;  // get first one
                                            }
                                            // Start of servicing
                                            if (JRrrecv1 != null)
                                            {
                                                JRInstmt1.j = (int)JRrrecv1.getInvoc();
                                                JRInstmt1.serviced = true;
                                                JRInstmt1.iter.remove(JRInstmt1.j);
                                                JRInstmt1.releaseIter();
                                                JRInstmt1.unlock();
                                                {
                                                    try {
                                                        {
                                                            // Begin Expr2
                                                            System.out.println("received GO: " + x);
                                                            // Reply
                                                            { if (JRrrecv1.retOp != null) {
                                                                JRrrecv1.retOp.send(jrvm.getTimestamp(), (edu.ucdavis.jr.RemoteHandler)null
                                                                , new Object [] {"HI"});
                                                                JRrrecv1.retOp = null;
                                                            } else {
                                                                java.lang.String JRevaltmp = "HI";
                                                            } }
                                                            // End Reply
                                                            
                                                            // Begin Expr2
                                                            n++;
                                                        }
                                                    } catch (Exception JRe) {
                                                        if (JRrrecv1.retOp != null && JRrrecv1.fretOp == null)
                                                        {
                                                            // forward of cocall
                                                            if ((JRrrecv1.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                                JRrrecv1.handler.JRhandler(JRe);
                                                            else {
                                                                // give preference to propagation through the call stack
                                                                JRrrecv1.retOp.send(jrvm.getTimestamp(), JRe);
                                                                JRrrecv1.retOp = null;
                                                            }
                                                        }
                                                        else if ((JRrrecv1.retOp != null) && (JRrrecv1.fretOp != null) && !(JRe instanceof java.rmi.RemoteException))
                                                        {
                                                            // for cocall exception handling in operation invocation
                                                            if (JRrrecv1.handler != null)
                                                                JRrrecv1.handler.JRhandler(JRe);
                                                            JRrrecv1.fretOp.send(jrvm.getTimestamp(), JRrrecv1.handler, (java.lang.Object []) null);
                                                            JRrrecv1.fretOp = null;
                                                        }
                                                        else if ((JRrrecv1.handler != null) && !(JRe instanceof java.rmi.RemoteException))
                                                        {
                                                            // this should only be a send
                                                            JRrrecv1.handler.JRhandler(JRe);
                                                        }
                                                    }
                                                }
                                                }
                                                else
                                                    JRInstmt1.releaseIter();
                                                // End of servicing
                                                // End InniArm
                                                break;
                                            }
                                            
                                        }
                                    }
                                    if (!JRInstmt1.serviced)
                                    {
                                        // must block and loop
                                        JRInstmt1.waitOnLock();
                                    }
                                } while (!JRInstmt1.serviced);
                            }
                            // End Inni
                            
                        }
                    }
                } catch (Exception JRe)    {
                    if (retOp != null && fretOp == null)
                    {
                	// if it is a forward cocall with handler
                	if ((handler != null) && !(JRe instanceof java.rmi.RemoteException))
                	    handler.JRhandler(JRe);
                	else
                	    // give preference to propagation through the call stack
                	    retOp.send(jrvm.getTimestamp(), JRe);
                    }
                    else if ((retOp != null) && (fretOp != null) && !(JRe instanceof java.rmi.RemoteException))
                    {
                	// for COSTMT exception handling in operation
                	if (handler != null)
                	    handler.JRhandler(JRe);
                	fretOp.send(jrvm.getTimestamp(), handler, (java.lang.Object []) null);
                    }
                    else if ((handler != null) && !(JRe instanceof java.rmi.RemoteException))
                    {
                	// this should only be for a send/forward
                	handler.JRhandler(JRe);
                	// can rethrow below just to get out of this method
                    }
                    // rethrow the proper type of exception
                    // catch all
                    throw new jrRuntimeError("Unhandled exception: " + JRe.toString());
                }
            }
            static {
                try {
                    op_MYPROCESS_voidTovoid.send(jrvm.getTimestamp(), (java.lang.Object []) null);
                } catch (Exception JRe) { throw new jrRuntimeError(JRe.toString()); }
            };
            
            protected boolean JRcalled = false;
            protected JRmain jrresref;
            public Object JRgetjrresref()
            { try {return jrresref.clone(); } catch (Exception e) {/* not gonna happen */ return null; } }
            protected void JRinit() {
            	if(this.JRcalled) return;
            	jrresref = new JRmain(op_MYPROCESS_voidTovoid, op_GO_intTojavadotlangdotString, op_run_voidTovoidThrowsjavadotlangdotNullPointerException);
            	this.JRcalled = true;
            }
            private boolean JRproc = false;
            private void JRprocess() {
            	if (JRproc) return;
            	JRproc = true;
            }
        }
