Example #1
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.IEvent eventsCasted = item.As <NMF.Models.Meta.IEvent>();
     if ((eventsCasted != null))
     {
         this._parent.Events.Add(eventsCasted);
     }
     NMF.Models.Meta.IReference referencesCasted = item.As <NMF.Models.Meta.IReference>();
     if ((referencesCasted != null))
     {
         this._parent.References.Add(referencesCasted);
     }
 }
Example #2
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.IEvent eventItem = item.As <NMF.Models.Meta.IEvent>();
     if (((eventItem != null) &&
          this._parent.Events.Remove(eventItem)))
     {
         return(true);
     }
     NMF.Models.Meta.IReference referenceItem = item.As <NMF.Models.Meta.IReference>();
     if (((referenceItem != null) &&
          this._parent.References.Remove(referenceItem)))
     {
         return(true);
     }
     return(false);
 }
Example #3
0
 private void PerformChecksForModelElement(NMF.Models.Meta.IReference reference, IModelElement element, IModelElement other)
 {
     if (reference.IsContainment)
     {
         AssertAreEqual(element, other.Parent);
     }
     if (reference.Opposite != null)
     {
         if (reference.Opposite.UpperBound == 1)
         {
             AssertAreEqual(element, other.GetReferencedElement(reference.Opposite));
         }
         else
         {
             AssertIsTrue(other.GetReferencedElements(reference.Opposite).Cast <IModelElement>().Contains(element));
         }
     }
 }