Exemplo n.º 1
0
 private static void UpdateChildNamesForFactTypeDelayedWorker(ModelElement element)
 {
     if (!element.IsDeleted)
     {
         FactType factType = (FactType)element;
         foreach (ConceptTypeChild child in ConceptTypeChildHasPathFactType.GetConceptTypeChild(factType))
         {
             LinkedElementCollection <FactType> factTypePath = ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(child);
             int      pathCount;
             RoleBase towardsRole;
             RoleBase fromRole;
             if (0 != (pathCount = factTypePath.Count) &&
                 factType == factTypePath[pathCount - 1] &&
                 null != (towardsRole = FactTypeMapsTowardsRole.GetTowardsRole(factType)) &&
                 null != (fromRole = towardsRole.OppositeRole))
             {
                 string resolvedName = ResolveRoleName(fromRole);
                 ConceptTypeReferencesConceptType reference;
                 if (null != (reference = child as ConceptTypeReferencesConceptType))
                 {
                     // Match original backwards pattern
                     reference.OppositeName = resolvedName;
                     child.Name             = ResolveRoleName(towardsRole);
                 }
                 else
                 {
                     child.Name = resolvedName;
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 private static void UpdateNamesForObjectTypeDelayed(ModelElement element)
 {
     if (!element.IsDeleted)
     {
         ObjectType  objectType     = (ObjectType)element;
         string      objectTypeName = objectType.Name;
         ConceptType conceptType    = ConceptTypeIsForObjectType.GetConceptType(objectType);
         LinkedElementCollection <FactType> pathFactTypes;
         int      factTypeCount;
         RoleBase towardsRole;
         RoleBase oppositeRole;
         if (null != conceptType)
         {
             // Precheck name to minimize downstream calls, the property change
             // will check itself.
             if (conceptType.Name != objectTypeName)
             {
                 conceptType.Name = objectTypeName;
                 foreach (ConceptTypeReferencesConceptType reference in ConceptTypeReferencesConceptType.GetLinksToReferencingConceptTypeCollection(conceptType))
                 {
                     pathFactTypes = ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(reference);
                     if (0 != (factTypeCount = pathFactTypes.Count) &&
                         null != (towardsRole = FactTypeMapsTowardsRole.GetTowardsRole(pathFactTypes[factTypeCount - 1])) &&
                         null != (oppositeRole = towardsRole.OppositeRole))
                     {
                         reference.OppositeName = ResolveRoleName(oppositeRole);
                     }
                 }
                 foreach (ConceptTypeReferencesConceptType reference in ConceptTypeReferencesConceptType.GetLinksToReferencedConceptTypeCollection(conceptType))
                 {
                     pathFactTypes = ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(reference);
                     if (0 != (factTypeCount = pathFactTypes.Count) &&
                         null != (towardsRole = FactTypeMapsTowardsRole.GetTowardsRole(pathFactTypes[factTypeCount - 1])))
                     {
                         reference.Name = ResolveRoleName(towardsRole);
                     }
                 }
             }
         }
         InformationTypeFormat informationTypeFormat = InformationTypeFormatIsForValueType.GetInformationTypeFormat(objectType);
         if (null != informationTypeFormat)
         {
             if (informationTypeFormat.Name != objectTypeName)
             {
                 informationTypeFormat.Name = objectTypeName;
                 foreach (InformationType informationType in InformationType.GetLinksToConceptTypeCollection(informationTypeFormat))
                 {
                     pathFactTypes = ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(informationType);
                     if (0 != (factTypeCount = pathFactTypes.Count) &&
                         null != (towardsRole = FactTypeMapsTowardsRole.GetTowardsRole(pathFactTypes[factTypeCount - 1])) &&
                         null != (oppositeRole = towardsRole.OppositeRole))
                     {
                         informationType.Name = ResolveRoleName(oppositeRole);
                     }
                 }
             }
         }
     }
 }