Beispiel #1
0
            /// <summary>
            ///     PropagatesDependancy the elementToAdd to the dependancies of the elementToBrowse
            /// </summary>
            /// <param name="elementToBrowse"></param>
            /// <param name="elementToAdd"></param>
            private void PropagatesDependancy(Utils.ModelElement elementToBrowse, Utils.ModelElement elementToAdd)
            {
                if (!BrowsedElements.Contains(elementToBrowse))
                {
                    BrowsedElements.Add(elementToBrowse);

                    elementToAdd.AddDependancy(elementToBrowse);
                    if (elementToBrowse.CacheDependancy != null)
                    {
                        foreach (Utils.ModelElement depending in elementToBrowse.CacheDependancy)
                        {
                            object current = depending;
                            while (current != null)
                            {
                                Utils.ModelElement currentElement = current as Utils.ModelElement;
                                if (currentElement != null)
                                {
                                    PropagatesDependancy(currentElement, elementToAdd);
                                }

                                IEnclosed enclosed = current as IEnclosed;
                                if (enclosed != null)
                                {
                                    current = enclosed.Enclosing;
                                }
                                else
                                {
                                    current = null;
                                }
                            }
                        }
                    }
                }
            }
Beispiel #2
0
                protected override void VisitDesignator(Designator designator)
                {
                    base.VisitDesignator(designator);

                    Utils.ModelElement current = designator.Ref as Utils.ModelElement;
                    while (current != null && !(current is NameSpace) && !(current is Parameter))
                    {
                        bool change;

                        Variable variable = current as Variable;
                        if (variable != null)
                        {
                            change           = variable.AddDependancy(DependantFunction);
                            DependancyChange = DependancyChange || change;
                        }
                        else
                        {
                            StructureElement structureElement = current as StructureElement;
                            if (structureElement != null)
                            {
                                change           = structureElement.AddDependancy(DependantFunction);
                                DependancyChange = DependancyChange || change;

                                change           = structureElement.Structure.AddDependancy(DependantFunction);
                                DependancyChange = DependancyChange || change;
                            }
                            else
                            {
                                Function function = current as Function;
                                if (function != null)
                                {
                                    change           = function.AddDependancy(DependantFunction);
                                    DependancyChange = DependancyChange || change;
                                }
                            }
                        }

                        current = current.Enclosing as Utils.ModelElement;
                    }
                }
Beispiel #3
0
            /// <summary>
            ///     PropagatesDependancy all elements
            /// </summary>
            /// <param name="obj"></param>
            /// <param name="visitSubNodes"></param>
            public override void visit(BaseModelElement obj, bool visitSubNodes)
            {
                if (obj.CacheDependancy != null)
                {
                    BrowsedElements = new HashSet <Utils.ModelElement> {
                        obj
                    };

                    HashSet <Utils.ModelElement> dependingElements = obj.CacheDependancy;
                    obj.CacheDependancy = null;
                    foreach (Utils.ModelElement depending in dependingElements)
                    {
                        object current = depending;
                        while (current != null)
                        {
                            Utils.ModelElement currentElement = current as Utils.ModelElement;
                            if (currentElement != null)
                            {
                                PropagatesDependancy(currentElement, obj);
                            }

                            IEnclosed enclosed = current as IEnclosed;
                            if (enclosed != null)
                            {
                                current = enclosed.Enclosing;
                            }
                            else
                            {
                                current = null;
                            }
                        }
                    }
                }

                base.visit(obj, visitSubNodes);
            }