Exemple #1
0
        private void HighlightEdge(IEdge edge, string name, bool addAnnotation)
        {
            if (addAnnotation)
            {
                if (ycompClient.dumpInfo.IsExcludedGraph())
                {
                    ycompClient.AddEdgeEvenIfGraphExcluded(edge);
                }

                ycompClient.ChangeEdge(edge, realizers.MatchedEdgeRealizer);
                renderRecorder.AddEdgeAnnotation(edge, name);
            }
            else
            {
                ycompClient.ChangeEdge(edge, null);
                ycompClient.AnnotateElement(edge, null);
                renderRecorder.RemoveEdgeAnnotation(edge);
            }
        }
        private void AnnotateMatch(IMatch match, bool addAnnotation, string prefix, int nestingLevel, bool topLevel)
        {
            const int PATTERN_NESTING_DEPTH_FROM_WHICH_ON_TO_CLIP_PREFIX = 7;

            for (int i = 0; i < match.NumberOfNodes; ++i)
            {
                INode        node        = match.getNodeAt(i);
                IPatternNode patternNode = match.Pattern.Nodes[i];
                if (addAnnotation)
                {
                    if (patternNode.PointOfDefinition == match.Pattern ||
                        patternNode.PointOfDefinition == null && topLevel)
                    {
                        String name = match.Pattern.Nodes[i].UnprefixedName;
                        if (nestingLevel > 0)
                        {
                            if (nestingLevel < PATTERN_NESTING_DEPTH_FROM_WHICH_ON_TO_CLIP_PREFIX)
                            {
                                name = prefix + "/" + name;
                            }
                            else
                            {
                                name = "/|...|=" + nestingLevel + "/" + name;
                            }
                        }
                        renderRecorder.AddNodeAnnotation(node, name);
                    }
                }
                else
                {
                    ycompClient.AnnotateElement(node, null);
                    renderRecorder.RemoveNodeAnnotation(node);
                }
            }
            for (int i = 0; i < match.NumberOfEdges; ++i)
            {
                IEdge        edge        = match.getEdgeAt(i);
                IPatternEdge patternEdge = match.Pattern.Edges[i];
                if (addAnnotation)
                {
                    if (patternEdge.PointOfDefinition == match.Pattern ||
                        patternEdge.PointOfDefinition == null && topLevel)
                    {
                        String name = match.Pattern.Edges[i].UnprefixedName;
                        if (nestingLevel > 0)
                        {
                            if (nestingLevel < PATTERN_NESTING_DEPTH_FROM_WHICH_ON_TO_CLIP_PREFIX)
                            {
                                name = prefix + "/" + name;
                            }
                            else
                            {
                                name = "/|...|=" + nestingLevel + "/" + name;
                            }
                        }
                        renderRecorder.AddEdgeAnnotation(edge, name);
                    }
                }
                else
                {
                    ycompClient.AnnotateElement(edge, null);
                    renderRecorder.RemoveEdgeAnnotation(edge);
                }
            }
            AnnotateSubpatternMatches(match, addAnnotation, prefix, nestingLevel);
            AnnotateIteratedsMatches(match, addAnnotation, prefix, nestingLevel);
            AnnotateAlternativesMatches(match, addAnnotation, prefix, nestingLevel);
            AnnotateIndependentsMatches(match, addAnnotation, prefix, nestingLevel);
        }