Package org.openquark.cal.machine

Examples of org.openquark.cal.machine.CALExecutor.exec()


            CalMonitor meetingRoom =  (CalMonitor) executor.exec(entryPoints.get(1), new Object[] { new Integer(numberOfMeetings) });
            CalMonitor occupant = new CalMonitor();

            Object red = executor.exec(entryPoints.get(2), null);
            Object yellow = executor.exec(entryPoints.get(3), null);
            Object blue = executor.exec(entryPoints.get(4), null);

            //start the three chameneos, each with a different colors
            ChameneosThread t1 = ChameneosThread.makeChameneosThread(entryPoints.get(0), red, meetingRoom, occupant);
            ChameneosThread t2 = ChameneosThread.makeChameneosThread(entryPoints.get(0), yellow, meetingRoom, occupant);
            ChameneosThread t3 = ChameneosThread.makeChameneosThread(entryPoints.get(0), blue, meetingRoom, occupant);
View Full Code Here


        public void run() {
            try {
                synchronized (this) {
                    CALExecutor executor = calServices.getWorkspaceManager().makeExecutorWithNewContextAndDefaultProperties();

                    numMeetings = (Integer) executor.exec(entryPoint, new Object[] { color, meetingRoom,  occupant, new Integer(0)});
                    notify();
                }
                //System.out.println(numMeetings);
            } catch (CALExecutorException ex) {
                System.err.println("Unexpected CAL compilation error: " + ex);
View Full Code Here

        }
        CALExecutor executor = workspaceManager.makeExecutor(executionContext);
       
        try {
            for (int i = 0; i < nTimes; ++i) {
                Object result = executor.exec(entryPoint, new Object[] {new Integer(5000 + i)});
                System.out.println("the result of getNthPrime " + (5000 + i) + " is " + result);
            }
        } catch (CALExecutorException executorException) {
            System.out.println("Execution terminated with an executor exception:" + executorException);
        }                                 
View Full Code Here

        if (messageLogger.getNMessages() > 0) {
            System.err.println(messageLogger.toString());
        }
 
        try {
            Iterator<?> primesIterator = (Iterator<?>)executor.exec(allPrimesEntryPoint, null);
           
            BufferedReader inBuff = new BufferedReader(new BufferedReader(new java.io.InputStreamReader(System.in)));
                              
            while (true) {
               
View Full Code Here

        }       
        EntryPoint allPrimesEntryPoint = entryPoints.get(0);
        EntryPoint stringListEntryPoint = entryPoints.get(1);       
       
        try {
            Iterator<?> primesIterator = (Iterator<?>)executor.exec(allPrimesEntryPoint, null);
            Iterator<?> namesIterator = (Iterator<?>)executor.exec(stringListEntryPoint, null);    
                          
            BufferedReader inBuff = new BufferedReader(new BufferedReader(new java.io.InputStreamReader(System.in)));
                              
            while (true) {
View Full Code Here

        EntryPoint allPrimesEntryPoint = entryPoints.get(0);
        EntryPoint stringListEntryPoint = entryPoints.get(1);       
       
        try {
            Iterator<?> primesIterator = (Iterator<?>)executor.exec(allPrimesEntryPoint, null);
            Iterator<?> namesIterator = (Iterator<?>)executor.exec(stringListEntryPoint, null);    
                          
            BufferedReader inBuff = new BufferedReader(new BufferedReader(new java.io.InputStreamReader(System.in)));
                              
            while (true) {
               
View Full Code Here

            System.err.println(messageLogger.toString());
        }
             
        try {
           
            CalValue remainingPrimesCalValue = (CalValue)executor.exec(allPrimesExternalEntryPoint, null);
           
            EntryPoint nextNPrimesExternalEntryPoint =
                compiler.getEntryPoint(
                    EntryPointSpec.make(QualifiedName.make(CALPlatformTestModuleNames.M2, "nextNPrimesExternal")),
                    CALPlatformTestModuleNames.M2, messageLogger);
View Full Code Here

                        System.out.println("I'm extremely sorry, but I did not understand you. I'll assume one more prime.");
                    }
                                                            
                    //a java.util.List with 2 elements. The first is a java.util.List of nPrimesMore primes. The second is a CalValue
                    //containing the remaining primes (as a lazy internal CAL list).
                    List<?> result = (List<?>)executor.exec(nextNPrimesExternalEntryPoint, new Object[] {remainingPrimesCalValue, new Integer(nPrimesMore)});
                    List<?> nextNPrimes = (List<?>)result.get(0);
                    remainingPrimesCalValue = (CalValue)result.get(1);
                    System.out.println("the next " + nPrimesMore + " are " + nextNPrimes);
                   
                    //we can reset cached CAFs here if we like. (Works without this as well. The point here is to not hold onto
View Full Code Here

        EntryPoint stringListExternal = entryPoints.get(1);
        EntryPoint takeNExternal_ListOfInt = entryPoints.get(2);
        EntryPoint takeNExternal_ListOfString = entryPoints.get(3);
       
        try {
            CalValue remainingPrimesCalValue = (CalValue)executor.exec(allPrimesExternal, null);
            CalValue remainingNamesCalValue = (CalValue)executor.exec(stringListExternal, null);    
                          
            BufferedReader inBuff = new BufferedReader(new BufferedReader(new java.io.InputStreamReader(System.in)));
                              
            while (true) {
View Full Code Here

        EntryPoint takeNExternal_ListOfInt = entryPoints.get(2);
        EntryPoint takeNExternal_ListOfString = entryPoints.get(3);
       
        try {
            CalValue remainingPrimesCalValue = (CalValue)executor.exec(allPrimesExternal, null);
            CalValue remainingNamesCalValue = (CalValue)executor.exec(stringListExternal, null);    
                          
            BufferedReader inBuff = new BufferedReader(new BufferedReader(new java.io.InputStreamReader(System.in)));
                              
            while (true) {
               
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.