Example #1
0
 /// <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)
 {
     NMF.Models.Meta.IClass classItem = item.As <NMF.Models.Meta.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);
     }
     NMF.Models.Meta.IAttributeConstraint attributeConstraintItem = item.As <NMF.Models.Meta.IAttributeConstraint>();
     if (((attributeConstraintItem != null) &&
          this._parent.AttributeConstraints.Remove(attributeConstraintItem)))
     {
         return(true);
     }
     NMF.Models.Meta.IReferenceConstraint referenceConstraintItem = item.As <NMF.Models.Meta.IReferenceConstraint>();
     if (((referenceConstraintItem != null) &&
          this._parent.ReferenceConstraints.Remove(referenceConstraintItem)))
     {
         return(true);
     }
     return(false);
 }
Example #2
0
 /// <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)
 {
     NMF.Models.Meta.IAttributeConstraint attributeConstraintsCasted = item.As <NMF.Models.Meta.IAttributeConstraint>();
     if ((attributeConstraintsCasted != null))
     {
         this._parent.AttributeConstraints.Add(attributeConstraintsCasted);
     }
     NMF.Models.Meta.IReferenceConstraint referenceConstraintsCasted = item.As <NMF.Models.Meta.IReferenceConstraint>();
     if ((referenceConstraintsCasted != null))
     {
         this._parent.ReferenceConstraints.Add(referenceConstraintsCasted);
     }
 }
Example #3
0
 /// <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)
 {
     NMF.Models.Meta.IAttributeConstraint attributeConstraintItem = item.As <NMF.Models.Meta.IAttributeConstraint>();
     if (((attributeConstraintItem != null) &&
          this._parent.AttributeConstraints.Remove(attributeConstraintItem)))
     {
         return(true);
     }
     NMF.Models.Meta.IReferenceConstraint referenceConstraintItem = item.As <NMF.Models.Meta.IReferenceConstraint>();
     if (((referenceConstraintItem != null) &&
          this._parent.ReferenceConstraints.Remove(referenceConstraintItem)))
     {
         return(true);
     }
     return(false);
 }
Example #4
0
 /// <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)
 {
     NMF.Models.Meta.IClass baseTypesCasted = item.As <NMF.Models.Meta.IClass>();
     if ((baseTypesCasted != null))
     {
         this._parent.BaseTypes.Add(baseTypesCasted);
     }
     if ((this._parent.InstanceOf == null))
     {
         NMF.Models.Meta.IClass instanceOfCasted = item.As <NMF.Models.Meta.IClass>();
         if ((instanceOfCasted != null))
         {
             this._parent.InstanceOf = instanceOfCasted;
             return;
         }
     }
     if ((this._parent.Identifier == null))
     {
         NMF.Models.Meta.IAttribute identifierCasted = item.As <NMF.Models.Meta.IAttribute>();
         if ((identifierCasted != null))
         {
             this._parent.Identifier = identifierCasted;
             return;
         }
     }
     NMF.Models.Meta.IAttributeConstraint attributeConstraintsCasted = item.As <NMF.Models.Meta.IAttributeConstraint>();
     if ((attributeConstraintsCasted != null))
     {
         this._parent.AttributeConstraints.Add(attributeConstraintsCasted);
     }
     NMF.Models.Meta.IReferenceConstraint referenceConstraintsCasted = item.As <NMF.Models.Meta.IReferenceConstraint>();
     if ((referenceConstraintsCasted != null))
     {
         this._parent.ReferenceConstraints.Add(referenceConstraintsCasted);
     }
 }