Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.FunctionalAgent


            }
        }

        if (metadata instanceof FunctionalAgentMetadata) {

            FunctionalAgent envEntity = (FunctionalAgent)scopedEntity;
            PolymorphicVarContext polymorphicVarContext = PolymorphicVarContext.make();
            TypeExpr[] typePieces = envEntity.getTypeExpr().getTypePieces();

            CALDocComment caldoc = envEntity.getCALDocComment();

            // Add the result type.           
            text.append("<br>");
            text.append("<b>");
            text.append(GemCutter.getResourceString("ToolTipHelper_Returns"));
View Full Code Here


        /// ultimately ends up being used in expressions, not the instance method backing it.
        //
       
        Scope scope = null;
        String unqualifiedName = methodName;
        FunctionalAgent entityWithArgumentNames = classMethod;
        CALDocComment classMethodCALDocComment = classMethod.getCALDocComment();
        TypeExpr typeExpr = classInstance.getInstanceMethodType(methodName);
        ArgumentMetadata[] argMetadataArray = metadata.getArguments();
        String label = labelMaker.getLabel(classInstance, methodName);
       
View Full Code Here

        if (typeInfo != null) {
   
            FunctionalAgent[] entities = typeInfo.getFunctionalAgents();
   
            for (int i = 0; i < entities.length; ++i) {
                FunctionalAgent envEntity = entities [i];
                addGemEntity(new GemEntity(envEntity, virtualResourceManager));
            }
        }
    }
View Full Code Here

     */       
    protected ImageIcon getGemDisplayIcon(Gem gem) {
        // different icons for each type of gem
        if (gem instanceof FunctionalAgentGem) {
            FunctionalAgentGem functionalAgentGem = (FunctionalAgentGem) gem;
            FunctionalAgent functionalAgent = functionalAgentGem.getGemEntity().getFunctionalAgent();

            if (functionalAgent instanceof Function || functionalAgent instanceof ClassMethod) {
                return supercombinatorIcon;
            } else if (functionalAgent instanceof DataConstructor) {
                return constructorIcon;
View Full Code Here

                    ModuleTypeInfo typeInfo = workspaceManager.getModuleTypeInfo(moduleName);
                    if (typeInfo == null) {
                        iceLogger.log(Level.INFO, "The module " + moduleName + " does not exist.");
                    } else {
                        String functionName = qualifiedFunctionName.getUnqualifiedName();
                        FunctionalAgent function = typeInfo.getFunctionOrClassMethod(functionName);
                        if (function == null) {
                            iceLogger.log(Level.INFO, "The function " + qualifiedFunctionName + " does not exist.");
                        } else {                           
                            ScopedEntityNamingPolicy scopedEntityNamingPolicy = new ScopedEntityNamingPolicy.UnqualifiedUnlessAmbiguous(typeInfo);
                           
                            iceLogger.log(Level.INFO, qualifiedFunctionName + " :: " + function.getTypeExpr().toString(true, scopedEntityNamingPolicy) + "\n");
                           
                            CALDocComment comment;
                            String kind;
                            if (function instanceof Function) {
                                comment = ((Function)function).getCALDocComment();
View Full Code Here

        //  Now go over the function names and generate the helper functions and
        // QualifiedName constant.
        for (final Map.Entry<String, FunctionalAgent> entry : nameToFuncInfo.entrySet()) {
          
            String calFuncName = entry.getKey();
            FunctionalAgent functionalAgent = entry.getValue();

            CALDocComment cdc = functionalAgent.getCALDocComment();

            // We need to make sure the name for the helper function/qualified name field is
            // a valid java name.
            String javaFuncName = fixupVarName(calFuncName);
           
            // Add a binding method for the CAL function.
            // Essentially this method builds an application
            // of the function to the supplied arguments using our
            // source model.
           
            // Build up the argument names and types.
            TypeExpr te = functionalAgent.getTypeExpr();
            int nArgs = te.getArity();
            int nNamedArgs = functionalAgent.getNArgumentNames();
           
            String paramNames[] = CALDocToJavaDocUtilities.getArgumentNamesFromCALDocComment(cdc, functionalAgent);
            if (paramNames.length != nArgs)  {
                throw new NullPointerException ("Mismatch between arity and number of arguments for " + calFuncName);
            }
            String origParamNames[] = new String[paramNames.length];
            System.arraycopy(paramNames, 0, origParamNames, 0, origParamNames.length);
           
            JavaTypeName paramTypes[] = new JavaTypeName [paramNames.length];
           
            // If we have named arguments we should use those names.
            Set<String> paramNamesSet = new HashSet<String>();
            for (int i = 0; i < paramNames.length; ++i) {
                String name = paramNames[i];

                if (name == null) {
                    if (i < nNamedArgs) {
                        name = functionalAgent.getArgumentName(i);
                    }
                   
                    if (name == null || name.equals("")) {
                        name = null;
                        // There is no name for this argument in the functional entity.  This
View Full Code Here

            // and simply fall off the end with no additional HTML generated, which is what is intended in such cases.
           
            if (metadata instanceof FunctionalAgentMetadata) {
                QualifiedName qualifiedName = featureName.toQualifiedName();
                ModuleTypeInfo moduleTypeInfoForFeature = owner.getPerspective().getMetaModule(qualifiedName.getModuleName()).getTypeInfo();
                FunctionalAgent envEntity = moduleTypeInfoForFeature.getFunctionalAgent(qualifiedName.getUnqualifiedName());
               
                boolean isRequiredClassMethod = false;
                if (envEntity instanceof ClassMethod) {
                    ClassMethod method = (ClassMethod)envEntity;
                    isRequiredClassMethod = (method.getDefaultClassMethodName() == null); // no default -> required
                }
               
                CALDocComment caldoc = envEntity.getCALDocComment();
                buffer.append(getBasicMetadataHtml(owner, metadata, caldoc));
                buffer.append(getFunctionalAgentMetadataHtml(owner, (FunctionalAgentMetadata) metadata, url, caldoc, isRequiredClassMethod));
                buffer.append(getAdditionalMetadataHtml(owner, metadata, caldoc));
               
            } else if (metadata instanceof ModuleMetadata) {
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.FunctionalAgent

Copyright © 2018 www.massapicom. 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.