コード例 #1
0
            /// <summary>
            /// ChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.SetConstraint)
            /// </summary>
            private static void SetConstraintChangedRule(ElementPropertyChangedEventArgs e)
            {
                Guid propertyId = e.DomainProperty.Id;

                if (propertyId == SetConstraint.ModalityDomainPropertyId)
                {
                    SetConstraint constraint = (SetConstraint)e.ModelElement;
                    if (IsRelevantConstraint(constraint.Constraint))
                    {
                        foreach (Role role in constraint.RoleCollection)
                        {
                            // Note that constraint.FactTypeCollection does not resolve the
                            // BinarizedFactType. Notifying twice on one FactType is harmless
                            // due to delayed validation.
                            FactTypeConstraintPatternChanged(role.BinarizedFactType);
                        }
                    }
                }
                else if (propertyId == SetConstraint.NameDomainPropertyId)
                {
                    UniquenessConstraint uniquenessConstraint;
                    Uniqueness           uniqueness;
                    if (null != (uniquenessConstraint = e.ModelElement as UniquenessConstraint) &&
                        null != (uniqueness = UniquenessIsForUniquenessConstraint.GetUniqueness(uniquenessConstraint)))
                    {
                        uniqueness.Name = uniquenessConstraint.Name;
                    }
                }
            }
コード例 #2
0
ファイル: Verbalization.cs プロジェクト: ozialien/NORMA
 /// <summary>
 /// Implements <see cref="IVerbalize.GetVerbalization"/>
 /// </summary>
 protected bool GetVerbalization(TextWriter writer, IDictionary <Type, IVerbalizationSets> snippetsDictionary, IVerbalizationContext verbalizationContext, VerbalizationSign sign)
 {
     ORMCore.UniquenessConstraint constraint = UniquenessIsForUniquenessConstraint.GetUniquenessConstraint(this.Uniqueness);
     if (constraint != null)
     {
         verbalizationContext.DeferVerbalization(constraint, DeferVerbalizationOptions.None, null);
     }
     return(false);
 }
コード例 #3
0
            /// <summary>
            /// RolePlayerPositionChangeRule: typeof(ConstraintRoleSequenceHasRole)
            /// Propagate order changes in a uniqueness constraint to an absorbed uniqueness
            /// </summary>
            private static void UniquenessConstraintRoleOrderChanged(RolePlayerOrderChangedEventArgs e)
            {
                UniquenessConstraint constraint;
                Uniqueness           uniqueness;

                if (null != (constraint = e.SourceElement as UniquenessConstraint) &&
                    e.SourceDomainRole.Id == ConstraintRoleSequenceHasRole.ConstraintRoleSequenceDomainRoleId &&
                    null != (uniqueness = UniquenessIsForUniquenessConstraint.GetUniqueness(constraint)))
                {
                    uniqueness.ConceptTypeChildCollection.Move(e.OldOrdinal, e.NewOrdinal);
                }
            }
コード例 #4
0
            /// <summary>
            /// DeletingRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ConstraintRoleSequenceHasRole)
            /// Propagate role deletion in a uniqueness constraint to an absorbed uniqueness
            /// </summary>
            private static void UniquenessConstraintRoleDeleting(ElementDeletingEventArgs e)
            {
                UniquenessConstraint          constraint;
                Uniqueness                    uniqueness;
                ConstraintRoleSequenceHasRole link     = (ConstraintRoleSequenceHasRole)e.ModelElement;
                ConstraintRoleSequence        sequence = link.ConstraintRoleSequence;

                if (!sequence.IsDeleting &&
                    null != (constraint = sequence as UniquenessConstraint) &&
                    !link.Role.IsDeleting &&
                    null != (uniqueness = UniquenessIsForUniquenessConstraint.GetUniqueness(constraint)))
                {
                    uniqueness.ConceptTypeChildCollection.RemoveAt(ConstraintRoleSequenceHasRole.GetLinksToRoleCollection(sequence).IndexOf(link));
                }
            }