Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.TypeExpr


        TypeExpr[] argTypes = gemEntity.getTypeExpr ().getTypePieces ();

        for (int argN = 0; argN < gemEntity.getNNamedArguments (); ++argN) {
            String argName = gemEntity.getNamedArgument (argN);

            TypeExpr argType = argTypes[argN];

            if (canBindType (argType)) {
                InputListItem item = new InputListItem (argName, argType);
               
                if (initialInputBindings != null && argN < initialInputBindings.size()) {
View Full Code Here


        GemEntity gemEntity = wizardState.getGemEntity();

        TypeExpr[] argTypes = gemEntity.getTypeExpr ().getTypePieces ();
       
        for (int argN = 0; argN < gemEntity.getNNamedArguments (); ++argN) {
            TypeExpr argType = argTypes [argN];
           
            String argName = gemEntity.getNamedArgument (argN);
           
            InputBinding inputBinding = null;
           
View Full Code Here

                orphanedInputs.remove(input);
            }
            newInputParts.add(input);
           
            // update the input type.
            TypeExpr inputType = reflectedInput.getType();
            input.setType(inputType);
           
            // update the reflection map
            inputToReflectedInputMap.put(input, reflectedInput);
           
View Full Code Here

            }

            //add all metrics/properties combinations that produce printable outputs
            BasicCALServices calServices = MonitorApp.getInstance().getCalServices();
            for (final MessagePropertyDescription propertyInfo : messagePropertyDescriptions) {
                TypeExpr propertyType = propertyInfo.getCalType(calServices);
                TypeExpr printableType = calServices.getTypeFromString(MonitorApp.TARGET_MODULE, "Cal.Samples.BusinessActivityMonitor.BAM.Printable a => a");

                Set<GemEntity> gemEntities = new MetricGemFilter(propertyType, printableType ).getMatchingGems();
                for (final GemEntity gemEntity : gemEntities) {
                    MetricDescription metricDescription=new MetricDescription(gemEntity.getName(), propertyInfo );
                    model.addElement(new MetricItem (metricDescription));                       
View Full Code Here

    private static class BooleanGemFilter extends GemFilter {

        //only select gems that return a boolean
        @Override
        public boolean select (GemEntity gemEntity) {
            TypeExpr gemTypeExpr = gemEntity.getTypeExpr();
     
            return gemTypeExpr.getResultType().isNonParametricType(CAL_Prelude.TypeConstructors.Boolean);
        }
View Full Code Here

    private static class ListGemFilter extends GemFilter {

        //only select gems that map from a list to a list
        @Override
        public boolean select (GemEntity gemEntity) {
            TypeExpr gemTypeExpr = gemEntity.getTypeExpr();

            return (gemTypeExpr.getArgumentType() != null &&
                    gemTypeExpr.getArgumentType().isListType() &&
                    gemTypeExpr.getResultType().isListType());
        }
View Full Code Here

        if (this.gemEntity == null) {
            XMLPersistenceHelper.handleBadDocument(nameElem, "No functional agent found for " + gemName);
        }

        // Set the part types if any
        TypeExpr scType = gemEntity.getTypeExpr();
        if (scType != null) {
           
            // Check that the entity has the right number of applications.
            if (scType.getArity() != getNInputs()) {
                XMLPersistenceHelper.handleBadDocument(nameElem,
                                                             "Error loading " + gemName + ".  Functional agent has " +
                                                               scType.getArity() + " inputs, saved with " + getNInputs() + ".");
            }
           
            setPartTypes(scType.getTypePieces());
        }
    }
View Full Code Here

        // field editor to return
        final JComponent fieldEditor;
        final PartInput inputPart = recordFieldSelectionGem.getInputPart();
       
        final TypeExpr inputTypeExpr;
        TypeExpr outputTypeExpr = TypeExpr.makeParametricType();
       
        //determine the input type
        if (inputPart.isConnected() ) {
            inputTypeExpr = inputPart.inferType(tableTop.getTypeCheckInfo()) ;
            if (recordFieldSelectionGem.getOutputPart().getConnection() != null) {
                outputTypeExpr = recordFieldSelectionGem.getOutputPart().inferType(tableTop.getTypeCheckInfo());
            }
        } else if (inputPart.isBurnt() && recordFieldSelectionGem.getOutputPart().getConnection() != null) {  
            TypeExpr outputType = recordFieldSelectionGem.getOutputPart().inferType(tableTop.getTypeCheckInfo());
           
            if (outputType.getArity() > 0) {
                TypeExpr[] typePieces = outputType.getTypePieces(1);
                inputTypeExpr = typePieces[0];
                outputTypeExpr = typePieces[1];
            } else {
                inputTypeExpr = null;
            }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public boolean select(GemEntity gemEntity) {

        TypeExpr gemType = gemEntity.getTypeExpr();

        // no need to check if the gem doesn't have enough inputs.
        if (gemType.getArity() < filterInputTypes.length) {
            return false;
        }
       
        // Instantiate members for the other select()
        TypeExpr[] typePieces = gemType.getTypePieces();
        TypeExpr outputType = typePieces[typePieces.length - 1];

        Bag remainingInputTypes = new HashBag(Arrays.asList(typePieces));
        remainingInputTypes.remove(outputType, 1);

        return select(new ArrayList<TypeExpr>(), remainingInputTypes, outputType);
View Full Code Here

            // Create a set that represents the remaining input types that will be passed down to the next level.
            Bag remainingInputTypesArg = new HashBag(remainingInputTypes);

            for (Iterator it = remainingInputTypes.iterator(); it.hasNext(); ) {

                TypeExpr nextType = (TypeExpr)it.next();

                inputTypesToTry.add(nextType);
                remainingInputTypesArg.remove(nextType, 1);

                // recursive call.
View Full Code Here

TOP

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

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.