Package org.openquark.gems.client

Examples of org.openquark.gems.client.CollectorGem$CollectingPart


   
    /**
     * This adds a collector for the message input
     */
    private void addCollectorForMessage () {
        messageGem = new CollectorGem ();
        messageGem.setName ("messages");
       
        // We must set the type of the message collector gem to ensure that the type of the
        // gem graph will not be ambiguous. To see why the type might be ambiguous,
        // consider the average metric (BAM.average),
View Full Code Here


            // 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

            //create the gem to compute this metric
            FunctionalAgentGem computeMetricGem = new FunctionalAgentGem(calServices.getGemEntity(md.getGemName()));
            gemGraph.addGem(computeMetricGem);
               
            //create the collector gem for this metric
            CollectorGem metricGem = new CollectorGem ();
            metricGem.setName(makeCollectorName(md.getInternalName()));
            gemGraph.addGem(metricGem);
           
            gemGraph.connectGems( messagePropertyReflector.getOutputPart(), computeMetricGem.getInputPart(0));
            gemGraph.connectGems( computeMetricGem.getOutputPart(), metricGem.getInputPart(0));
           
            bindingContext.addCollector(md, metricGem);
           
            assert graphIsValid() : gemGraph.toString();
        }
View Full Code Here

        /**
         * @see org.openquark.samples.bam.BindingContext#getCollector(java.lang.Object)
         */
        public CollectorGem getCollector (Object id) {
            if (collectorMap != null) {
                CollectorGem gem = collectorMap.get (id);
               
                if (gem != null) {
                    return gem;
                } else {
                    throw new IllegalArgumentException ("There is no collector for " + id);
View Full Code Here

     */
    @Override
    public Gem getOutputGem (BasicCALServices calServices, GemGraph gemGraph,
            BindingContext bindingContext) {

        CollectorGem metricCollector = bindingContext.getCollector(metricDescription);
       
        ReflectorGem reflectorGem = new ReflectorGem (metricCollector);
       
        gemGraph.addGem(reflectorGem);
       
View Full Code Here

    /**
     * @see org.openquark.samples.bam.model.InputBinding#getOutputGem(BasicCALServices, org.openquark.gems.client.GemGraph, org.openquark.samples.bam.BindingContext)
     */
    @Override
    public Gem getOutputGem (BasicCALServices calServices, GemGraph gemGraph, BindingContext bindingContext) {
        CollectorGem collectorGem = bindingContext.getCollector(propertyInfo);
       
        ReflectorGem reflectorGem = new ReflectorGem (collectorGem);
       
        gemGraph.addGem(reflectorGem);
       
View Full Code Here

            ExplorerGemNode explorerGemNode = (ExplorerGemNode) treeNode;
           
            Gem gem = explorerGemNode.getGem();
           
            if (gem instanceof CollectorGem) {
                CollectorGem collectorGem = (CollectorGem) gem;
                gem = new ReflectorGem(collectorGem);
            }
            tableTopExplorer.getExplorerOwner().beginUndoableEdit();
            dragGestureEvent.startDrag(null, null, mousePointOffset, new TableTopExplorerSelection(gem, tableTopExplorer), this);
                 
View Full Code Here

        GemGraph gemGraph = new GemGraph();
        gemGraph.getTargetCollector().setName("positiveOutlierDetector");
       
        // A collector targeting the target collector. It will be an argument of the positiveOutlierDetector gem.
        CollectorGem sourceDataCollector = new CollectorGem();
        sourceDataCollector.setName("sourceData");
        gemGraph.addGem(sourceDataCollector);
       
        // Local collector: avg
        // Corresponding source: avg = Summary.average sourceData;
        CollectorGem avgCollector = new CollectorGem();
        avgCollector.setName("avg");
        gemGraph.addGem(avgCollector);
       
        // a ReflectorGem provides as output the value that is collected by the corresponding CollectorGem
        ReflectorGem sourceDataReflector1 = new ReflectorGem(sourceDataCollector);
        gemGraph.addGem(sourceDataReflector1);
       
        Gem averageGem = gemFactory.makeFunctionalAgentGem(CAL_Summary.Functions.average);
        gemGraph.addGem(averageGem);
       
        gemGraph.connectGems(sourceDataReflector1.getOutputPart(), averageGem.getInputPart(0));
       
        gemGraph.connectGems(averageGem.getOutputPart(), avgCollector.getInputPart(0));
       
        // Local collector: stdDev
        // Corresponding source: stdDev = Summary.populationStandardDeviation sourceData;
        CollectorGem stdDevCollector = new CollectorGem();
        stdDevCollector.setName("stdDev");
        gemGraph.addGem(stdDevCollector);
       
        ReflectorGem sourceDataReflector2 = new ReflectorGem(sourceDataCollector);
        gemGraph.addGem(sourceDataReflector2);
       
        Gem populationStdDevGem = gemFactory.makeFunctionalAgentGem(CAL_Summary.Functions.populationStandardDeviation);
        gemGraph.addGem(populationStdDevGem);
       
        gemGraph.connectGems(sourceDataReflector2.getOutputPart(), populationStdDevGem.getInputPart(0));
       
        gemGraph.connectGems(populationStdDevGem.getOutputPart(), stdDevCollector.getInputPart(0));
       
        // Local collector: isPositiveOutlier
        // Corresponding source: isPositiveOutlier x_1 = x_1 - avg >= x_2 * stdDev;
        CollectorGem isPositiveOutlierCollector = new CollectorGem();
        isPositiveOutlierCollector.setName("isPositiveOutlier");
        gemGraph.addGem(isPositiveOutlierCollector);
       
        Gem subtractGem = gemFactory.makeFunctionalAgentGem(CAL_Prelude.Functions.subtract);
        gemGraph.addGem(subtractGem);
       
        ReflectorGem avgReflector = new ReflectorGem(avgCollector);
        gemGraph.addGem(avgReflector);
       
        // Retarget the first input of subtract to the isPositiveOutlier collector
        //
        // This means that the first input of subtract is no longer an argument for the overall Gem defined by the
        // GemGraph's target collector, but rather a local argument for the isPositiveOutlier collector.
        gemGraph.retargetInputArgument(subtractGem.getInputPart(0), isPositiveOutlierCollector, -1);
        gemGraph.connectGems(avgReflector.getOutputPart(), subtractGem.getInputPart(1));
       
        Gem multiplyGem = gemFactory.makeFunctionalAgentGem(CAL_Prelude.Functions.multiply);
        gemGraph.addGem(multiplyGem);
       
        ReflectorGem stdDevReflector = new ReflectorGem(stdDevCollector);
        gemGraph.addGem(stdDevReflector);
       
        // Leave the first input of multiply targeting the target collector (it will be an argument of the positiveOutlierDetector gem),
        // but hook up the second input of multiply to the stdDev reflector
        gemGraph.connectGems(stdDevReflector.getOutputPart(), multiplyGem.getInputPart(1));
       
        Gem greaterThanEqualsGem = gemFactory.makeFunctionalAgentGem(CAL_Prelude.Functions.greaterThanEquals);
        gemGraph.addGem(greaterThanEqualsGem);
       
        gemGraph.connectGems(subtractGem.getOutputPart(), greaterThanEqualsGem.getInputPart(0));
        gemGraph.connectGems(multiplyGem.getOutputPart(), greaterThanEqualsGem.getInputPart(1));
       
        gemGraph.connectGems(greaterThanEqualsGem.getOutputPart(), isPositiveOutlierCollector.getInputPart(0));
       
        // Update the reflected inputs of the collector because one of the inputs in the gem tree was retargeted
        isPositiveOutlierCollector.updateReflectedInputs();
       
        // Construct the gem tree connected to the target collector
        ReflectorGem isPositiveOutlierReflector = new ReflectorGem(isPositiveOutlierCollector);
        gemGraph.addGem(isPositiveOutlierReflector);

View Full Code Here

        GemGraph gemGraph = new GemGraph();
        gemGraph.getTargetCollector().setName("demoMap");
       
        // Two collectors forming the two arguments of the demoMap gem.
        CollectorGem mapFunctionCollector = new CollectorGem();
        mapFunctionCollector.setName("mapFunction");
        gemGraph.addGem(mapFunctionCollector);
       
        CollectorGem listCollector = new CollectorGem();
        listCollector.setName("list");
        gemGraph.addGem(listCollector);
       
        // Construct the test for checking whether the 'list' value is the empty list.
        Gem isEmptyGem = gemFactory.makeFunctionalAgentGem(CAL_Prelude.Functions.isEmpty);
        gemGraph.addGem(isEmptyGem);
View Full Code Here

        if (method == NavAddress.WORKSPACE_METHOD || method == NavAddress.SEARCH_METHOD) {
            return null;
           
        } else if (method == NavAddress.COLLECTOR_METHOD) {
            CollectorGem collector = owner.getCollector(address.getBase());
            metadata = collector != null ? collector.getDesignMetadata() : null;
           
        } else {
            CALFeatureName featureName = address.toFeatureName();
            CALWorkspace workspace = owner.getPerspective().getWorkspace();
           
View Full Code Here

TOP

Related Classes of org.openquark.gems.client.CollectorGem$CollectingPart

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.