Package org.openquark.gems.client

Examples of org.openquark.gems.client.Gem$PartInput


            addCollectorsForMessageProperties ();
            addCollectorsForMetrics();
           
            logger.report("Time to add collectors: ", true);
           
            Gem triggerResultGem = addTriggerGems ();          
            logger.report("Time to add triggers: ", true);
           
            Gem actionResultGem = addActionGems ();           
            logger.report("Time to add actions: ", true);
           
            finishGemGraph (triggerResultGem, actionResultGem);
           
            logger.report("Time to finish graph: ", true);
View Full Code Here


            // Create a code gem to extract the ith property from the message list input
            // e.g. the code gem for the 5th message property would be:
            // List.map (\msg -> msg.#5) msg
            // which takes the input list of message tuples as input, and outputs a new list
            // containing the 5th element of every message.
            Gem propertyExtractorGem = new CodeGem(codeAnalyser, CAL_List.Functions.map.getQualifiedName() + " (\\msg -> msg.#" + ++i +") msg", Collections.<String>emptySet());
            gemGraph.addGem(propertyExtractorGem);
                    
            // create the collector gem for this message property
            CollectorGem propertyGem = new CollectorGem ();
            propertyGem.setName (makeCollectorName (propertyInfo.name));  
            gemGraph.addGem(propertyGem);
           
            gemGraph.connectGems(messageReflector.getOutputPart(), propertyExtractorGem.getInputPart(0));   
            gemGraph.connectGems(propertyExtractorGem.getOutputPart(), propertyGem.getInputPart(0));   

            bindingContext.addCollector(propertyInfo, propertyGem);
           
            assert graphIsValid() : gemGraph.toString();
        }
View Full Code Here

    private Gem addGems (List<? extends BoundGemDescription> boundGemList) {
        if (boundGemList == null || boundGemList.size() == 0) {
            throw new IllegalArgumentException ("The list of bound gems must not be empty");
        }
       
        Gem result = null;
       
        for (int gemN = 0; gemN < boundGemList.size(); ++gemN) {
            BoundGemDescription gemDescription = boundGemList.get(gemN);
                      
            FunctionalAgentGem zipGem = new FunctionalAgentGem(calServices.getGemEntity(zippingGems[gemDescription.getVariableBindingCount()]));
            FunctionalAgentGem zippingFunctionGem = new FunctionalAgentGem(calServices.getGemEntity(gemDescription.getQualifiedName()));
                 
            gemGraph.addGem(zipGem);
            gemGraph.addGem(zippingFunctionGem);

            connectInputs (zipGem, zippingFunctionGem, gemDescription, gemGraph);
           
            if (result == null) {
                result = zipGem;
            } else {
                FunctionalAgentGem zipGem2 = new FunctionalAgentGem(calServices.getGemEntity(CAL_List.Functions.zipWith));
                gemGraph.addGem (zipGem2);
               
                FunctionalAgentGem andGem = new FunctionalAgentGem(calServices.getGemEntity(CAL_Prelude.Functions.and));
                gemGraph.addGem (andGem);
                andGem.getInputPart(0).setBurnt(true);
                andGem.getInputPart(1).setBurnt(true);
               
                gemGraph.connectGems(andGem.getOutputPart(), zipGem2.getInputPart(0));
                gemGraph.connectGems(zipGem.getOutputPart(), zipGem2.getInputPart(1));
                gemGraph.connectGems(result.getOutputPart(), zipGem2.getInputPart(2));
               
                result = zipGem2;
               
        
           
View Full Code Here

        gemGraph.connectGems(zippingFunctionGem.getOutputPart(),zipGem.getInputPart(zipInput++));
       
        //connect the parameters
        for (int inputN = 0; inputN < boundGemDescription.getBindingCount(); ++inputN) {
            InputBinding binding = boundGemDescription.getNthBinding(inputN);
            Gem outputGem = binding.getOutputGem(calServices, gemGraph, bindingContext);

            if (binding.isConstant()) {
                gemGraph.connectGems(outputGem.getOutputPart(), zippingFunctionGem.getInputPart(inputN));
            } else {
                zippingFunctionGem.getInputPart(inputN).setBurnt(true);
                gemGraph.connectGems(outputGem.getOutputPart(), zipGem.getInputPart(zipInput++));
            }
        }
       
        assert graphIsValid() : gemGraph.toString();
    }
View Full Code Here

       
        gemGraph.connectGems(andGem.getOutputPart(), zipGem.getInputPart(0));
        gemGraph.connectGems(triggerResultGem.getOutputPart(), zipGem.getInputPart(1));
        gemGraph.connectGems(actionResultGem.getOutputPart(), zipGem.getInputPart(2));
       
        Gem toIteratorGem = new FunctionalAgentGem(calServices.getGemEntity(CAL_List.Functions.toJIterator));
        gemGraph.addGem(toIteratorGem);
       
        gemGraph.connectGems(zipGem.getOutputPart(), toIteratorGem.getInputPart(0));          
        gemGraph.connectGems( toIteratorGem.getOutputPart(), gemGraph.getTargetCollector().getInputPart(0));
    }
View Full Code Here

     */
    @Override
    public Gem getOutputGem (BasicCALServices calServices, GemGraph gemGraph, BindingContext bindingContext) {
        List<InputBinding> allBindings = parseAndSubstitute (template, argumentBindings);
       
        Gem resultGem = null;
       
        if (allBindings.isEmpty()) {
            resultGem = new GemFactory(calServices).makeValueGem("");
           
            gemGraph.addGem(resultGem);
        } else {
            // build the string up from right to left
            for (int bindingN = allBindings.size() - 1; bindingN >= 0; --bindingN) {
                InputBinding binding = allBindings.get (bindingN);
               
                Gem gem = binding.getOutputGem(calServices, gemGraph, bindingContext);
               
                if (resultGem == null) {
                    resultGem = gem;
                } else {
                    resultGem = appendGems(calServices, gemGraph, gem, resultGem);
View Full Code Here

        return resultGem;
    }

    private Gem appendGems(BasicCALServices calServices, GemGraph gemGraph, Gem gem1, Gem gem2) {
       
        Gem appendGem = new FunctionalAgentGem(calServices.getGemEntity(QualifiedName.makeFromCompoundName("Cal.Samples.BusinessActivityMonitor.BAM.appendStrings")));
        gemGraph.addGem(appendGem);
               
        if  ( !(gem1 instanceof ValueGem)) {
            appendGem.getInputPart(0).setBurnt(true);
        }
        if ( !(gem2 instanceof ValueGem)) {
            appendGem.getInputPart(1).setBurnt(true);
        }
       
        switch (appendGem.getTargetInputs().size()) {
        case 2:
            gemGraph.connectGems(gem1.getOutputPart(), appendGem.getInputPart(0));
            gemGraph.connectGems(gem2.getOutputPart(), appendGem.getInputPart(1));
            return appendGem;
        case 1:
            Gem mapGem = new FunctionalAgentGem(calServices.getGemEntity(CAL_List.Functions.map));
            gemGraph.addGem(mapGem);
            gemGraph.connectGems(appendGem.getOutputPart(), mapGem.getInputPart(0));
           
            if (!(gem1 instanceof ValueGem)) {
                gemGraph.connectGems(gem1.getOutputPart(), mapGem.getInputPart(1));
                gemGraph.connectGems(gem2.getOutputPart(), appendGem.getInputPart(1));
            } else {
                gemGraph.connectGems(gem2.getOutputPart(), mapGem.getInputPart(1));
                gemGraph.connectGems(gem1.getOutputPart(), appendGem.getInputPart(0));
            }
            return mapGem;
           
        default:
            Gem zipGem = new FunctionalAgentGem(calServices.getGemEntity(CAL_List.Functions.zipWith));
            gemGraph.addGem(zipGem);
            gemGraph.connectGems(appendGem.getOutputPart(), zipGem.getInputPart(0));
            gemGraph.connectGems(gem1.getOutputPart(), zipGem.getInputPart(1));
            gemGraph.connectGems(gem2.getOutputPart(), zipGem.getInputPart(2));
            return zipGem;         
        }

    }
View Full Code Here

            ExplorerCellRenderer renderer = (ExplorerCellRenderer)getCellRenderer();
            if (!renderer.isPointOverIcon(relativePoint)) {
                Object node = path.getLastPathComponent();
                if (node instanceof ExplorerGemNode) {
                    // Check if the gem is focusable which means it will be rendered as a hyperlink
                    Gem gem = ((ExplorerGemNode)node).getGem();
                    if (navigationHelper.isFocusable(gem)) {
                        return true;
                    }
                }
            }
View Full Code Here

            if (isFocusablePoint(location)) {
                TreePath path = getPathForLocation(location.x, location.y);
                Object node = path.getLastPathComponent();
                if (node instanceof ExplorerGemNode) {
                    // Indicate that the navigation helper should change to focus on the gem
                    Gem gem = ((ExplorerGemNode)node).getGem();
                    navigationHelper.focusOn(gem);
                }
            }
        }
View Full Code Here

        this.tree = tree;
        this.editorComponent = null;
       
        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();
            ValueEditor valueEditor = ved.getRootValueEditor(
                                                tableTopExplorer.getValueEditorHierarchyManager(),
                                                input.getType(),
                                                entityName,
                                                input.getInputNum(),
                                                tableTopExplorer.getMetadataRunner(gem));
            setupEditorComponentForPartInput(valueEditor, input);
            setupValueEditor(node, valueEditor);
       
        } else if (userObject instanceof CodeGem || userObject instanceof CollectorGem) {
            final Gem editedGem = (Gem)userObject;
            final ExplorerGemNameEditor nameEditor = explorerOwner.getGemNameEditor(editedGem);
            editorComponent = nameEditor.getComponent();
           

            // Add a focus listener to commit the changes when the field loses focus.
View Full Code Here

TOP

Related Classes of org.openquark.gems.client.Gem$PartInput

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.