/// <summary> /// Creates a new association relating given classes. /// The associations ends are stored in the same order as the classes /// are passed to the association. /// </summary> /// <param name="classes"> /// References to the classes to be associated /// </param> /// <param name="_schema"> /// Reference to the Schema instance that is the top /// of this model hierarchy. /// </param> /// <param name="createAdaptee"> /// If true, adapted nUML Association is also created, otherwise it is left null. /// </param> /// <param name="_stTarget"> /// UML metaclass to be targeted by the stereotype /// </param> public _Association(IEnumerable <Class> classes, Schema _schema, bool createAdaptee, StereotypeTarget _stTarget) : base(_schema, _stTarget) { if (createAdaptee) { adaptedElement = (NUmlType)NUml.Uml2.Create.Association(); } associationEnds = new ObservableCollection <AssociationEnd>(); referencingJoins = new ObservableCollection <NestingJoin>(); // Create an association end adapter for each class in the association foreach (Class end in classes) { associationEnds.Add(new _AssociationEnd(this, end, Schema)); } // If the association is self-referencing and the classes collection // contains only one class, create a second end referencing the same class. if (associationEnds.Count == 1) { foreach (Class cls in classes) { associationEnds.Add(new _AssociationEnd(this, cls, Schema)); } } }
/// <summary> /// Creates a new empty class. /// </summary> /// <param name="createAdaptee">If true, the adaptee (NUml.Uml2.Class is created), otherwise it is left null.</param> /// <param name="_schema">Reference to the Schema instance that is the top /// of this model hierarchy.</param> /// <param name="_metaclass">The metaclass.</param> protected _Class(bool createAdaptee, Schema _schema, StereotypeTarget _metaclass) : base(_schema, _metaclass) { if (createAdaptee) { adaptedElement = (NUmlType)NUml.Uml2.Create.Class(); } associations = new ObservableCollection <Association>(); attributes = new ObservableCollection <Property>(); generalizations = new ObservableCollection <Generalization>(); operations = new ObservableCollection <Operation>(); specifications = new ObservableCollection <Generalization>(); attributes.CollectionChanged += OnAttributesChanged; operations.CollectionChanged += OnOperationsChanged; }
/// <summary> /// Creates a new empty element. /// Adaptee is set to null, an empty comments collection is created. /// </summary> /// <param name="_schema"> /// Reference to the Schema instance that is the top /// of this model hierarchy. /// </param> /// <param name="_metaclass"> /// UML metaclass(es) that this element is instance of. /// Bitwise combination of StereotypeTarget values. /// </param> protected _Element(Schema _schema, StereotypeTarget _metaclass) { adaptedElement = default(NUmlType); comments = new ObservableCollection <Comment>(); comments.CollectionChanged += OnCommentsChanged; appliedStereotypes = new ObservableCollection <StereotypeInstance>(); schema = _schema; metaclass = _metaclass; if (schema.Model != null && schema.Model.VersionManager != null) { schema.Model.VersionManager.SetAsFirstVersion(this, schema.Model.Version); } #if DEBUG ElementWatcher.InvokeElementCreated(this); #endif Guid = XCaseGuid.NewGuid(); }
/// <summary> /// Creates a new empty type without the adaptee. /// </summary> /// <param name="_schema"> /// Reference to the Schema instance that is the top /// of this model hierarchy. /// </param> /// <param name="_metaclass"> /// UML metaclass(es) that this element is instance of. /// Bitwise combination of StereotypeTarget values. /// </param> protected _DataType(Schema _schema, StereotypeTarget _metaclass) : base(_schema, _metaclass) { package = null; }
/// <summary> /// Creates a new typed element. /// </summary> /// <param name="_schema"> /// Reference to the Schema instance that is the top /// of this model hierarchy. /// </param> /// <param name="_metaclass"> /// UML metaclass(es) that this element is instance of. /// Bitwise combination of StereotypeTarget values. /// </param> protected _TypedElement(Schema _schema, StereotypeTarget _metaclass) : base(_schema, _metaclass) { }
/// <summary> /// Creates a new NamedElement adapter but not the adaptee. /// </summary> /// <param name="_schema"> /// Reference to the Schema instance that is the top /// of this model hierarchy. /// </param> /// <param name="_metaclass"> /// UML metaclass(es) that this element is instance of. /// Bitwise combination of StereotypeTarget values. /// </param> public _NamedElement(Schema _schema, StereotypeTarget _metaclass) : base(_schema, _metaclass) { }