Package org.openquark.cal.compiler.CompositionNode

Examples of org.openquark.cal.compiler.CompositionNode.Collector


                return replacementCollector;
            }
           
            // Create a replacement.
            String unqualifiedName = collector.getUnqualifiedName();
            Collector originalTarget = collector.getTargetCollector();
            Collector targetCollector = originalTarget == null ? null : getCollector(originalTarget, rootNodes, excludedCollectorReplacementMap);
           
            replacementCollector = new SyntheticCollector(unqualifiedName, targetCollector, null, null);
           
            // Add to the map.
            excludedCollectorReplacementMap.put(collector, replacementCollector);
View Full Code Here


                // Get the arguments for the anonymous root:
                List<CompositionArgument> freeArguments = subtreeNodeInfo.getFreeUnburntArguments();
               
                // Iterate over the collectors, finding the parent of the deepest one (ie. the scope which encloses the smallest scope).
                // This will be the maximal scope at which the root can be validly defined.
                Collector deepestCollectorParent = rootNodeTarget;

                // Ensure that the deepest collector parent is an original collector..
                // Note: iterates over the whole excludedCollectorReplacementMap, so potentially slow.
                if (deepestCollectorParent instanceof SyntheticCollector) {
                    for (final Map.Entry<Collector, SyntheticCollector> entry : excludedCollectorReplacementMap.entrySet()) {                      
                        final Collector excludedCollector = entry.getKey();
                        if (deepestCollectorParent == entry.getValue()) {
                            deepestCollectorParent = excludedCollector;
                            break;
                        }
                    }
                }
               
                for (final Collector collector : subtreeNodeInfo.getCollectorsUsed()) {                  

                    if (enclosesCollector(deepestCollectorParent, collector)) {
                        if (collector != deepestCollectorParent && collector.getTargetCollector() != deepestCollectorParent) {
                            deepestCollectorParent = collector.getTargetCollector();
                        }

                    } else if (!enclosesCollector(collector.getTargetCollector(), deepestCollectorParent)) {
                        CALCompiler.COMPILER_LOGGER.log(Level.SEVERE, "Inconsistent hierarchy detected for anonymous gem tree.");
                        return null;
                    }
                }
               
                // Replace with replacement if necessary.
                if (excludedCollectorReplacementMap.containsKey(deepestCollectorParent)) {
                    deepestCollectorParent = excludedCollectorReplacementMap.get(deepestCollectorParent);
                }
               
                // Get an anonymous name which doesn't conflict with any other names.
                String candidateCollectorName = "anonymousCollector";
                while (collectorNames.contains(candidateCollectorName)) {
                    candidateCollectorName = "anonymousCollector" + nextAnonymousNameIndex;
                    nextAnonymousNameIndex++;
                }
                collectorNames.add(candidateCollectorName);
               
                // Create the collector with that name.
                Collector collectorForRoot = new SyntheticCollector(candidateCollectorName, deepestCollectorParent, freeArguments, uncollectedRoot);
               
                // Add to the map.
                collectorToUncollectedRootMap.put(collectorForRoot, uncollectedRoot);
            }
           
View Full Code Here

             *   if non-null, map from excluded collector to the collector with which it should be considered to be replaced.
             */
            void mapCollectorToTarget(Collector collector, Map<Collector, SyntheticCollector> excludedCollectorReplacementMap) {
               
                // Add the collector-target mappings.
                Collector targetCollector = collector.getTargetCollector();
               
                // If it's supposed to be an excluded collector, set the replacement as the target.
                if (excludedCollectorReplacementMap != null && excludedCollectorReplacementMap.containsKey(targetCollector)) {
                    targetCollector = excludedCollectorReplacementMap.get(targetCollector);
                }
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.CompositionNode.Collector

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.