Examples of runFunction()


Examples of org.openquark.cal.services.BasicCALServices.runFunction()

        EntryPointSpec isWellFormedEntrySpec =
            EntryPointSpec.make(QualifiedName.make(ModuleName.make("Cal.Test.Experimental.Utilities.XmlParserEngine_Tests"),
                    "isWellFormed"));
       
        Object result = cal.runFunction(isWellFormedEntrySpec, new Object[] { path });
       
        assert result instanceof Boolean;
        return ((Boolean)result).booleanValue();
   }
   
View Full Code Here

Examples of org.openquark.cal.services.BasicCALServices.runFunction()

       
        EntryPointSpec parseAndWriteSecondXmlCanonicalFormEntrySpec =
            EntryPointSpec.make(QualifiedName.make(ModuleName.make("Cal.Test.Experimental.Utilities.XmlParserEngine_Tests"),
                    "parseAndWriteSecondXmlCanonicalForm"));
       
        cal.runFunction(parseAndWriteSecondXmlCanonicalFormEntrySpec, new Object[] { inPath, outPath });
    }
   
    // CAL interop.
    /** Property which when set will override the default workspace file. */
    private static final String WORKSPACE_FILE_PROPERTY = "xmlparser.test.workspace";
View Full Code Here

Examples of org.openquark.cal.services.BasicCALServices.runFunction()

                EntryPointSpec addSpec = EntryPointSpec.make(QualifiedName.make(CAL_Prelude.MODULE_NAME, "add"), new InputPolicy[] {
                    InputPolicy.INT_INPUT_POLICY,
                    InputPolicy.DEFAULT_INPUT_POLICY
                }, OutputPolicy.DEFAULT_OUTPUT_POLICY);
               
                Object addResult = calServices.runFunction(addSpec, new Object[] { new Integer(1), new Integer(2) });
                System.out.println("Example 1 output: " + addResult.toString());
            }

            {
                //Example 2: Inferring input types
View Full Code Here

Examples of org.openquark.cal.services.BasicCALServices.runFunction()

                EntryPointSpec addSpec = EntryPointSpec.make(QualifiedName.make(CAL_Prelude.MODULE_NAME, "add"), new InputPolicy[] {
                    InputPolicy.DEFAULT_INPUT_POLICY,
                    InputPolicy.DEFAULT_INPUT_POLICY
                }, OutputPolicy.INT_OUTPUT_POLICY);
               
                Object addResult = calServices.runFunction(addSpec, new Object[] { new Integer(3), new Integer(4) });
                System.out.println("Example 2 output: " + addResult.toString());
            }

            {
                //Example 3: CAL Value Output
View Full Code Here

Examples of org.openquark.cal.services.BasicCALServices.runFunction()

                //the opaque output is then used as an input to another CAL function.
              
                //Call the allPrimes and get the resulting infinite list as an opaque CAL Value
                EntryPointSpec allPrimesSpec = EntryPointSpec.make(QualifiedName.make(CALPlatformTestModuleNames.M1, "allPrimes"), new InputPolicy[0], OutputPolicy.CAL_VALUE_OUTPUT_POLICY);

                Object allPrimesResult = calServices.runFunction(allPrimesSpec, new Object[0]);

                //Use List.Take to get 5 values from the primes list.
                //As List.take is a polymorphic function we must specify the type of the CAL input
                EntryPointSpec primesSpec = EntryPointSpec.make(QualifiedName.make(CAL_List.MODULE_NAME, "take"), new InputPolicy[] {
                    InputPolicy.DEFAULT_INPUT_POLICY,
View Full Code Here

Examples of org.openquark.cal.services.BasicCALServices.runFunction()

                //As List.take is a polymorphic function we must specify the type of the CAL input
                EntryPointSpec primesSpec = EntryPointSpec.make(QualifiedName.make(CAL_List.MODULE_NAME, "take"), new InputPolicy[] {
                    InputPolicy.DEFAULT_INPUT_POLICY,
                    InputPolicy.makeTypedCalValueInputPolicy(SourceModel.TypeExprDefn.List.make(SourceModel.TypeExprDefn.TypeCons.make(CAL_Prelude.TypeConstructors.Int)))}, OutputPolicy.DEFAULT_OUTPUT_POLICY);

                List<?> primesList = (List<?>) calServices.runFunction(primesSpec, new Object[] { new Integer(5), allPrimesResult});

                System.out.println("Example 3 output: " + primesList.toString());
            }
           
           
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.