/// <summary> /// Removes the given item from the collection /// </summary> /// <returns>True, if the item was removed, otherwise False</returns> /// <param name="item">The item that should be removed</param> public override bool Remove(NMF.Models.IModelElement item) { IClass classItem = item.As <IClass>(); if (((classItem != null) && this._parent.BaseTypes.Remove(classItem))) { return(true); } if ((this._parent.InstanceOf == item)) { this._parent.InstanceOf = null; return(true); } if ((this._parent.Identifier == item)) { this._parent.Identifier = null; return(true); } IAttributeConstraint attributeConstraintItem = item.As <IAttributeConstraint>(); if (((attributeConstraintItem != null) && this._parent.AttributeConstraints.Remove(attributeConstraintItem))) { return(true); } IReferenceConstraint referenceConstraintItem = item.As <IReferenceConstraint>(); if (((referenceConstraintItem != null) && this._parent.ReferenceConstraints.Remove(referenceConstraintItem))) { return(true); } return(false); }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(NMF.Models.IModelElement item) { IAttributeConstraint attributeConstraintsCasted = item.As <IAttributeConstraint>(); if ((attributeConstraintsCasted != null)) { this._parent.AttributeConstraints.Add(attributeConstraintsCasted); } IReferenceConstraint referenceConstraintsCasted = item.As <IReferenceConstraint>(); if ((referenceConstraintsCasted != null)) { this._parent.ReferenceConstraints.Add(referenceConstraintsCasted); } }
/// <summary> /// Removes the given item from the collection /// </summary> /// <returns>True, if the item was removed, otherwise False</returns> /// <param name="item">The item that should be removed</param> public override bool Remove(NMF.Models.IModelElement item) { IAttributeConstraint attributeConstraintItem = item.As <IAttributeConstraint>(); if (((attributeConstraintItem != null) && this._parent.AttributeConstraints.Remove(attributeConstraintItem))) { return(true); } IReferenceConstraint referenceConstraintItem = item.As <IReferenceConstraint>(); if (((referenceConstraintItem != null) && this._parent.ReferenceConstraints.Remove(referenceConstraintItem))) { return(true); } return(false); }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(NMF.Models.IModelElement item) { IClass baseTypesCasted = item.As <IClass>(); if ((baseTypesCasted != null)) { this._parent.BaseTypes.Add(baseTypesCasted); } if ((this._parent.InstanceOf == null)) { IClass instanceOfCasted = item.As <IClass>(); if ((instanceOfCasted != null)) { this._parent.InstanceOf = instanceOfCasted; return; } } if ((this._parent.Identifier == null)) { IAttribute identifierCasted = item.As <IAttribute>(); if ((identifierCasted != null)) { this._parent.Identifier = identifierCasted; return; } } IAttributeConstraint attributeConstraintsCasted = item.As <IAttributeConstraint>(); if ((attributeConstraintsCasted != null)) { this._parent.AttributeConstraints.Add(attributeConstraintsCasted); } IReferenceConstraint referenceConstraintsCasted = item.As <IReferenceConstraint>(); if ((referenceConstraintsCasted != null)) { this._parent.ReferenceConstraints.Add(referenceConstraintsCasted); } }
private void LoadReferenceConstraint(IReferenceConstraint refConstraint) { GetOrCreateDecomposedReference(refConstraint.Constrains).AddConstraint(refConstraint.References); }