Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.QualifiedName


       
        /**
         * {@inheritDoc}
         */
        public int compare(Class<?> o1, Class<?> o2) {
            QualifiedName foreignTypeName1 = generationInfo.getForeignTypeName(o1);
            QualifiedName foreignTypeName2 = generationInfo.getForeignTypeName(o2);
           
            if (foreignTypeName1 == null) {
                throw new IllegalStateException("No name generated for foreignType: " + o1);
            }
           
View Full Code Here


       
        if (type == CLASS_INSTANCE || type == INSTANCE_METHOD) {

            String[] pieces = getName().split(PART_SEPARATOR);
           
            QualifiedName typeClassName = QualifiedName.makeFromCompoundName(pieces[0]);
            String typeIdentifier = pieces[1];
           
            return ClassInstanceIdentifier.make(typeClassName, typeIdentifier);
        }
       
View Full Code Here

     * @param entityName If the gem has been renamed, this should be the new name of the gem.
     */
    void updateGemEntity(CALWorkspace workspace, QualifiedName entityName) throws GemEntityNotPresentException  {       
        // TODO: we should also check/morph for sc arity and type changes, and revalidate any connections.
        GemEntity newEntity = workspace.getGemEntity(entityName);
        QualifiedName oldName = gemEntity.getName();
        if (newEntity == null) {
            throw new GemEntityNotPresentException(gemEntity.getName());
        }
        this.gemEntity = newEntity;
       
        if (oldName == entityName){
            nameChangeListener.nameChanged(new NameChangeEvent(this, oldName.getQualifiedName()));
        }
    }
View Full Code Here

        super.loadXML(superGemElem, gemContext);

        // Get the name
        Element nameElem = (childElems.size() < 2) ? null : (Element) childElems.get(1);
        XMLPersistenceHelper.checkIsElement(nameElem);
        QualifiedName gemName = CALPersistenceHelper.elementToQualifiedName(nameElem);
       
        // Get the supercombinator and its type
        this.gemEntity = workspace.getGemEntity(gemName);
        if (this.gemEntity == null) {
            XMLPersistenceHelper.handleBadDocument(nameElem, "No functional agent found for " + gemName);
View Full Code Here

     * Add an entity to this module.
     * @param gemEntity the entity to add.
     */
    public void addGemEntity(GemEntity gemEntity) {

        QualifiedName entityName = gemEntity.getName();

        if (!entityName.getModuleName().equals(getName())) {
            throw new IllegalArgumentException("Entity must be a member of module: " + getName());
        }

        GemEntity oldValue = nameToEntityMap.put(gemEntity.getName().getUnqualifiedName(), gemEntity);
        if (oldValue == null) {
View Full Code Here

       
        if (userObject instanceof ValueGem) {
            ValueGem valueGem = (ValueGem)userObject;
            Gem connectedGem = valueGem.getOutputPart().getConnectedGem();
            int connectedInputNum = valueGem.isConnected() ? valueGem.getOutputPart().getConnection().getDestination().getInputNum() : -1;
            QualifiedName entityName = null;
            if (connectedGem instanceof FunctionalAgentGem) {
                entityName = ((FunctionalAgentGem)connectedGem).getName();
            }
               
            ValueEditorDirector ved = tableTopExplorer.getValueEditorDirector();
            ValueEditor valueEditor = ved.getRootValueEditor(
                                                tableTopExplorer.getValueEditorHierarchyManager(),
                                                valueGem.getValueNode(),
                                                entityName,
                                                connectedInputNum,
                                                connectedGem == null ? null : tableTopExplorer.getMetadataRunner(connectedGem));
            setupEditorComponentForValueGem(valueEditor, valueGem);
            setupValueEditor(node, valueEditor);
       
        } else if (userObject instanceof Gem.PartInput) {
            Gem.PartInput input = (Gem.PartInput)userObject;
            Gem gem = input.getGem();
            QualifiedName entityName = null;
            if (gem instanceof FunctionalAgentGem) {
                entityName = ((FunctionalAgentGem)gem).getName();
            }
               
            ValueEditorDirector ved = tableTopExplorer.getValueEditorDirector();
View Full Code Here

*/
class UnqualifiedNameCaseInsensitiveComparator implements Comparator<GemEntity> {

    public int compare(GemEntity e1, GemEntity e2) {
       
        QualifiedName name1 = e1.getName();
        QualifiedName name2 = e2.getName();

        return name1.getUnqualifiedName().compareToIgnoreCase(name2.getUnqualifiedName());
    }
View Full Code Here

    /** {@inheritDoc} */
    @Override
    public final Class<?> getForeignClass(final String qualifiedTypeConsName, final String foreignName) throws UnableToResolveForeignEntityException {

        final QualifiedName typeName = QualifiedName.makeFromCompoundName(qualifiedTypeConsName);

        //fetch the Class object from the type's ForeignTypeInfo

        final ForeignTypeInfo foreignTypeInfo =
            program
            .getModule(typeName.getModuleName())
            .getModuleTypeInfo()
            .getTypeConstructor(typeName.getUnqualifiedName())
            .getForeignTypeInfo();

        if (foreignTypeInfo != null) {
            return foreignTypeInfo.getForeignType();
        }
View Full Code Here

        int nArguments = appChain.length - 1;
        Expression.Var var = appChain[0].asVar();
          
        // fixup the names for Prelude.and and Prelude.or
        QualifiedName qn = var.getName();
        if (!qn.getModuleName().equals(CAL_Prelude.MODULE_NAME) || (!qn.getUnqualifiedName().equals("and") && !qn.getUnqualifiedName().equals("or"))) {
            return null;
        }
       
        int opCode;
        if (qn.getUnqualifiedName().equals("and")) {
            opCode = PrimOps.PRIMOP_AND;
        } else {
            opCode = PrimOps.PRIMOP_OR;
        }
           
View Full Code Here

        if (getShowConsoleInfo()) {
            System.out.println("Executing:\n" + scDef);
        }
       
        // Compile the definition, indicating that this is an adjunct
        QualifiedName targetName = QualifiedName.make(getTargetModule(), getTarget().getTargetName(currentModuleTypeInfo));
        entryPoint = getWorkspaceManager().getCompiler().getEntryPoint(scDef, EntryPointSpec.make(targetName, inputPolicies, outputPolicy), targetName.getModuleName(), logger);
        if (entryPoint == null) {       
            throw new ProgramCompileException(CompilerMessage.Severity.ERROR, logger.getFirstError());
        }
    }
View Full Code Here

TOP

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

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.