Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.ClassInstance


        //
        int nClassInstances = classInstances.length;
        beginClassInstancesDocSection(nClassInstances, classInstances, calcMaxScopeOfClassInstances(classInstances));
        for (int i = 0; i < nClassInstances; i++) {

            ClassInstance classInstance = classInstances[i];
            perModuleInstanceIndex.add(new IndexEntry(getClassInstanceDisplayName(classInstance), labelMaker.getLabel(classInstance), minScopeForInstanceClassAndInstanceType(classInstance), IndexEntry.Kind.INSTANCE));
           
            generateClassInstanceDoc(classInstance, i);
        }
        endClassInstancesDocSection(nClassInstances);
View Full Code Here


    private void addInstancesOfTypeConsToList(TypeConstructor typeConstructor, ModuleName nameOfModuleToSearchForInstances, List<ClassInstance> instances) {
        ModuleTypeInfo moduleToSearchForInstances = programModelManager.getModuleTypeInfo(nameOfModuleToSearchForInstances);
       
        int nClassInstances = moduleToSearchForInstances.getNClassInstances();
        for (int i = 0; i < nClassInstances; i++) {
            ClassInstance classInstance = moduleToSearchForInstances.getNthClassInstance(i);
           
            if (classInstance.isTypeConstructorInstance()) {
                ClassInstanceIdentifier.TypeConstructorInstance identifier =
                    (ClassInstanceIdentifier.TypeConstructorInstance)classInstance.getIdentifier();
               
                ////
                /// Only add the instance to the list of know instances if both the type class
                /// and the type constructors in the instance type have their documentation generated.
                //
View Full Code Here

    private void addIntancesOfTypeClassToList(TypeClass typeClass, ModuleName nameOfModuleToSearchForInstances, List<ClassInstance> instances) {
        ModuleTypeInfo moduleToSearchForInstances = programModelManager.getModuleTypeInfo(nameOfModuleToSearchForInstances);
       
        int nClassInstances = moduleToSearchForInstances.getNClassInstances();
        for (int i = 0; i < nClassInstances; i++) {
            ClassInstance classInstance = moduleToSearchForInstances.getNthClassInstance(i);
           
            ////
            /// Only add the instance to the list of know instances if both the type class
            /// and the type constructors in the instance type have their documentation generated.
            //
            if (classInstance.getTypeClass().getName().equals(typeClass.getName()) &&
                    isDocForClassInstanceGenerated(classInstance)) {
               
                instances.add(classInstance);
            }
        }
View Full Code Here

           
            // If the type constructor is declared as inputable/outputable in the containing module
            // we skip it because generating inputable/outputable instances would conflict.
            boolean alreadyInputableOutputable = false;
            for (int j = 0, k = module.getNClassInstances(); j < k; ++j) {
                ClassInstance ci = module.getNthClassInstance(j);
                if (ci.getTypeClass().getName().equals(CAL_Prelude.TypeClasses.Inputable) ||
                    ci.getTypeClass().getName().equals(CAL_Prelude.TypeClasses.Outputable)) {
                    // Check the instance type
                    TypeExpr instanceTypeExpr = ci.getType();
                    TypeConsApp tca = instanceTypeExpr.rootTypeConsApp();
                    if (tca != null) {
                        if (tca.getRoot().getName().equals(tc.getName())) {
                            alreadyInputableOutputable = true;
                        }
View Full Code Here

                    caldocComments.put("class method " + method.getName().getQualifiedName(), method.getCALDocComment());
                }
            }
           
            for (int i = 0, n = moduleInfo.getNClassInstances(); i < n; i++) {
                final ClassInstance instance = moduleInfo.getNthClassInstance(i);
                final TypeClass typeClass = instance.getTypeClass();
               
                caldocComments.put("instance " + instance.getNameWithContext(), instance.getCALDocComment());

                for (int j = 0, m = typeClass.getNClassMethods(); j < m; j++) {
                    final ClassMethod method = typeClass.getNthClassMethod(j);
                    caldocComments.put(
                        "instance method " + instance.getNameWithContext() + " " + method.getName().getQualifiedName(),
                        method.getCALDocComment());
                }
            }
           
            // Then visit each comment verifying the validity of unchecked references
View Full Code Here

            // We need to determine whether the existing enumeration has only a derived Eq instance,
            // or the full complement of derived instances (i.e. Eq, Ord, Bounded, Enum), so that
            // the correct selection can be shown in the derived instances combo box.
           
            TypeClass ordTypeClass = workingModuleTypeInfo.getVisibleTypeClass(CAL_Prelude.TypeClasses.Ord);
            ClassInstance ordInstance = workingModuleTypeInfo.getVisibleClassInstance(ordTypeClass, typeCons);
           
            TypeClass boundedTypeClass = workingModuleTypeInfo.getVisibleTypeClass(CAL_Prelude.TypeClasses.Bounded);
            ClassInstance boundedInstance = workingModuleTypeInfo.getVisibleClassInstance(boundedTypeClass, typeCons);
           
            TypeClass enumTypeClass = workingModuleTypeInfo.getVisibleTypeClass(CAL_Prelude.TypeClasses.Enum);
            ClassInstance enumInstance = workingModuleTypeInfo.getVisibleClassInstance(enumTypeClass, typeCons);
           
            if (ordInstance == null && boundedInstance == null && enumInstance == null) {
                getDerivedInstancesField().setSelectedItem(DerivedInstancesOption.EQ_ONLY_DERIVED_INSTANCES_OPTION);
            } else {
                getDerivedInstancesField().setSelectedItem(DerivedInstancesOption.EQ_ORD_BOUNDED_ENUM_DERIVED_INSTANCES_OPTION);               
View Full Code Here

        if (instanceCount > 0) {

            List<NavTreeNode> classInstanceNodes = new ArrayList<NavTreeNode>(instanceCount);
            for (int n = 0; n < instanceCount; n++) {
               
                ClassInstance instance = moduleInfo.getNthClassInstance(n);
               
                NavTreeNode classInstanceNode = new NavClassInstanceNode(moduleInfo.getNthClassInstance(n), moduleInfo);
                classInstanceNodes.add(classInstanceNode);
               
                // Load the instance methods.
                int methodCount = instance.getNInstanceMethods();
                if (methodCount > 0) {
   
                    List<NavInstanceMethodNode> instanceMethodNodes = new ArrayList<NavInstanceMethodNode>(methodCount);               
                    for (int k = 0; k < methodCount; k++) {
                        String methodName = instance.getTypeClass().getNthClassMethod(k).getName().getUnqualifiedName();
                        instanceMethodNodes.add(new NavInstanceMethodNode(moduleInfo.getNthClassInstance(n), methodName, moduleInfo));
                    }

                    addAllNodes(classInstanceNode, instanceMethodNodes, false);
                }
View Full Code Here

                buffer.append(getAdditionalMetadataHtml(owner, metadata, caldoc));
               
            } else if (metadata instanceof ClassInstanceMetadata) {
                ClassInstanceIdentifier classInstanceID = featureName.toInstanceIdentifier();
                ModuleTypeInfo moduleTypeInfoForFeature = owner.getPerspective().getMetaModule(featureName.toModuleName()).getTypeInfo();
                ClassInstance instance = moduleTypeInfoForFeature.getClassInstance(classInstanceID);
               
                CALDocComment caldoc = instance.getCALDocComment();
                buffer.append(getBasicMetadataHtml(owner, metadata, caldoc));
                buffer.append(getClassInstanceMetadataHtml(owner, (ClassInstanceMetadata) metadata));
                buffer.append(getAdditionalMetadataHtml(owner, metadata, caldoc));
               
            } else if (metadata instanceof InstanceMethodMetadata) {
                ClassInstanceIdentifier classInstanceID = featureName.toInstanceIdentifier();
                ModuleTypeInfo moduleTypeInfoForFeature = owner.getPerspective().getMetaModule(featureName.toModuleName()).getTypeInfo();
                ClassInstance instance = moduleTypeInfoForFeature.getClassInstance(classInstanceID);
               
                CALDocComment caldoc = instance.getMethodCALDocComment(featureName.toInstanceMethodName());
                buffer.append(getBasicMetadataHtml(owner, metadata, caldoc));
                buffer.append(getInstanceMethodMetadataHtml(owner, (InstanceMethodMetadata) metadata, url, caldoc));
                buffer.append(getAdditionalMetadataHtml(owner, metadata, caldoc));
            }
        }
View Full Code Here

            MetaModule metaModule = workspace.getNthMetaModule(n);
            ModuleTypeInfo moduleTypeInfo = metaModule.getTypeInfo();
           
            for (int i = 0, num = moduleTypeInfo.getNClassInstances(); i < num; i++) {
               
                ClassInstance instance = moduleTypeInfo.getNthClassInstance(i);
               
                if (instance.isTypeConstructorInstance() &&
                    ((ClassInstanceIdentifier.TypeConstructorInstance)instance.getIdentifier()).getTypeConsName().equals(typeCons.getName())) {
                    classes.add(instance.getTypeClass());
                    instances.add(instance);
                }
            }
        }
View Full Code Here

            MetaModule metaModule = workspace.getNthMetaModule(n);
            ModuleTypeInfo moduleTypeInfo = metaModule.getTypeInfo();
           
            for (int i = 0, num = moduleTypeInfo.getNClassInstances(); i < num; i++) {
               
                ClassInstance instance = moduleTypeInfo.getNthClassInstance(i);
                if (instance.isUniversalRecordInstance()) {
                    continue;
                }
               
                if (instance.getTypeClass().getName().equals(typeClass.getName())) {                  
                    QualifiedName typeConsName = ((TypeConsApp)instance.getType()).getName();
                    MetaModule typeModule = owner.getPerspective().getMetaModule(typeConsName.getModuleName());
                    TypeConstructor typeCons = typeModule.getTypeInfo().getTypeConstructor(typeConsName.getUnqualifiedName());
                    types.add(typeCons);
                    instances.add(instance);
                }
View Full Code Here

TOP

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

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.