public List <EvolutionChange> Translate(PSMDiagram diagramOldVersion, PSMDiagram diagramNewVersion) { ChangesDetectorContext context = new ChangesDetectorContext { NewVersion = diagramNewVersion.Version, OldVersion = diagramOldVersion.Version, Diagram = diagramNewVersion }; Diagram = diagramNewVersion; context.ScopeStack.Push(EChangeScope.Diagram); ChangesLookupManager.DetectLocalChanges(context); foreach (PSMClass rootClass in diagramNewVersion.Roots) { TranslateClass(rootClass, context); } EChangeScope pop = context.ScopeStack.Pop(); Debug.Assert(pop == EChangeScope.Diagram); EvolutionChangeSet set = new EvolutionChangeSet(context.Diagram, context.DetectedChanges, diagramOldVersion.Version, diagramNewVersion.Version); set.Verify(); return(context.DetectedChanges); }
public static bool FullElementsTemplateNeeded(PSMElement element, EvolutionChangeSet changeSet) { List <NodeElementWrapper> allContent = new List <NodeElementWrapper>(); List <NodeElementWrapper> represenetedContents = element.GetRepresentedElements(); List <NodeElementWrapper> nodeContents = element.GetSubtreeElements(); allContent.AddRange(represenetedContents); allContent.AddRange(nodeContents); return(allContent.Count() > 0 && changeSet.ContentInvalidated(element) /*&& allContent.Inline().Any(e => PSMTreeIterator.GetLowerMultiplicityOfContentElement(e) != 0)*/); }
public static bool FullAttributeTemplateNeeded(PSMElement element, EvolutionChangeSet changeSet) { List <NodeAttributeWrapper> allAttributes = new List <NodeAttributeWrapper>(); List <NodeAttributeWrapper> represenetedAttributes = element.GetRepresentedAttributes(); IEnumerable <NodeAttributeWrapper> nodeContents = element.GetAttributesUnderNode(); allAttributes.AddRange(represenetedAttributes); allAttributes.AddRange(nodeContents); return(allAttributes.Count() > 0 && changeSet.AttributesInvalidated(element) /*&& allAttributes.Inline().Any(e => PSMTreeIterator.GetLowerMultiplicityOfContentElement(e) != 0)*/); }
/// <summary> /// For context inside group /// </summary> public XsltGeneratorContext(EvolutionChangeSet changeSet, PSMElement bodyNode, bool inGroup, ContentGroup currentContentGroup) { BodyNode = bodyNode; InGroup = inGroup; ChangeSet = changeSet; CurrentContentGroup = currentContentGroup; if (inGroup && currentContentGroup == null) { throw new ArgumentException(); } if (!inGroup && currentContentGroup != null) { throw new ArgumentException(); } }
/// <summary> /// For context inside group /// </summary> public XsltGeneratorContext(EvolutionChangeSet changeSet, PSMElement bodyNode, ContentGroup currentContentGroup) : this(changeSet, bodyNode, true, currentContentGroup) { }
/// <summary> /// For context outside group /// </summary> public XsltGeneratorContext(EvolutionChangeSet changeSet, PSMElement bodyNode) : this(changeSet, bodyNode, false, null) { }