コード例 #1
0
 /// <summary>
 /// Creates a(n) ASCC based on the given <paramref name="specification"/>.
 /// <param name="specification">A specification for a(n) ASCC.</param>
 /// <returns>The newly created ASCC.</returns>
 /// </summary>
 public IAscc CreateAscc(AsccSpec specification)
 {
     return(new UpccAscc(UmlClass.CreateAssociation(AsccSpecConverter.Convert(specification, Name)), this));
 }
コード例 #2
0
 /// <summary>
 /// Updates a(n) ASCC to match the given <paramref name="specification"/>.
 /// <param name="ascc">A(n) ASCC.</param>
 /// <param name="specification">A new specification for the given ASCC.</param>
 /// <returns>The updated ASCC. Depending on the implementation, this might be the same updated instance or a new instance!</returns>
 /// </summary>
 public IAscc UpdateAscc(IAscc ascc, AsccSpec specification)
 {
     return(new UpccAscc(UmlClass.UpdateAssociation(((UpccAscc)ascc).UmlAssociation, AsccSpecConverter.Convert(specification, Name)), this));
 }
コード例 #3
0
        internal static UmlClassSpec Convert(AccSpec accSpec)
        {
            var umlClassSpec = new UmlClassSpec
            {
                Stereotype   = "ACC",
                Name         = accSpec.Name,
                TaggedValues = new[]
                {
                    new UmlTaggedValueSpec("businessTerm", accSpec.BusinessTerms),
                    new UmlTaggedValueSpec("definition", accSpec.Definition),
                    new UmlTaggedValueSpec("dictionaryEntryName", accSpec.DictionaryEntryName)
                    {
                        DefaultValue = GenerateDictionaryEntryNameDefaultValue(accSpec)
                    },
                    new UmlTaggedValueSpec("languageCode", accSpec.LanguageCode),
                    new UmlTaggedValueSpec("uniqueIdentifier", accSpec.UniqueIdentifier)
                    {
                        DefaultValue = GenerateUniqueIdentifierDefaultValue(accSpec)
                    },
                    new UmlTaggedValueSpec("versionIdentifier", accSpec.VersionIdentifier),
                    new UmlTaggedValueSpec("usageRule", accSpec.UsageRules),
                },
            };

            var dependencySpecs = new List <UmlDependencySpec>();

            if (accSpec.IsEquivalentTo != null)
            {
                dependencySpecs.Add(new UmlDependencySpec
                {
                    Stereotype = "isEquivalentTo",
                    Target     = ((UpccAcc)accSpec.IsEquivalentTo).UmlClass,
                    LowerBound = "0",
                    UpperBound = "1",
                });
            }
            umlClassSpec.Dependencies = dependencySpecs;

            var attributeSpecs = new List <UmlAttributeSpec>();

            if (accSpec.Bccs != null)
            {
                foreach (var bccSpec in accSpec.Bccs)
                {
                    attributeSpecs.Add(BccSpecConverter.Convert(bccSpec, accSpec.Name));
                }
            }
            umlClassSpec.Attributes = MakeAttributeNamesUnique(attributeSpecs);

            var associationSpecs = new List <UmlAssociationSpec>();

            if (accSpec.Asccs != null)
            {
                foreach (var asccSpec in accSpec.Asccs)
                {
                    associationSpecs.Add(AsccSpecConverter.Convert(asccSpec, accSpec.Name));
                }
            }
            umlClassSpec.Associations = MakeAssociationNamesUnique(associationSpecs);

            return(umlClassSpec);
        }