public IMultiplicityChange GetMultiplicityChange(PSMElement psmElement) { if (psmElement is PSMAssociation) { AssociationMultiplicityChange find = this.OfType <AssociationMultiplicityChange>().FirstOrDefault(ec => ec.Association == psmElement); return(find); } else { Debug.Assert(changesByTarget[psmElement].Count(c => c is IMultiplicityChange) <= 1); return(changesByTarget[psmElement].OfType <IMultiplicityChange>().FirstOrDefault()); } }
public bool MultiplicityChanged(PSMElement psmElement) { if (psmElement is PSMAssociation) { AssociationMultiplicityChange find = this.OfType <AssociationMultiplicityChange>().FirstOrDefault(ec => ec.Association == psmElement); return(find != null); } else { return(changesByTarget.ContainsKey(psmElement) && changesByTarget[psmElement].Any(change => (change.Element == psmElement && change is IMultiplicityChange) || (change is AssociationMultiplicityChange && ((PSMAssociation)change.Element).Child == psmElement))); } }
public static IList <EvolutionChange> Detect(Version v1, Version v2, PSMAssociation association) { List <EvolutionChange> result = new List <EvolutionChange>(); PSMAssociation psmAssociationOldVersion = (PSMAssociation)association.GetInVersion(v1); PSMAssociation psmAssociationNewVersion = (PSMAssociation)association.GetInVersion(v2); Debug.Assert(psmAssociationNewVersion != null && psmAssociationOldVersion != null); if ((psmAssociationOldVersion.Lower != psmAssociationNewVersion.Lower) || (psmAssociationOldVersion.Upper != psmAssociationNewVersion.Upper)) { AssociationMultiplicityChange c = new AssociationMultiplicityChange(association) { OldVersion = v1, NewVersion = v2 }; result.Add(c); } return(result); }