/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IRelationDomainAssignment defaultAssignmentCasted = item.As <IRelationDomainAssignment>(); if ((defaultAssignmentCasted != null)) { this._parent.DefaultAssignment.Add(defaultAssignmentCasted); } if ((this._parent.Pattern == null)) { IDomainPattern patternCasted = item.As <IDomainPattern>(); if ((patternCasted != null)) { this._parent.Pattern = patternCasted; return; } } if ((this._parent.RootVariable == null)) { IVariable rootVariableCasted = item.As <IVariable>(); if ((rootVariableCasted != null)) { this._parent.RootVariable = rootVariableCasted; return; } } }
/// <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(IModelElement item) { IRelationDomainAssignment relationDomainAssignmentItem = item.As <IRelationDomainAssignment>(); if (((relationDomainAssignmentItem != null) && this._parent.DefaultAssignment.Remove(relationDomainAssignmentItem))) { return(true); } if ((this._parent.Pattern == item)) { this._parent.Pattern = null; return(true); } return(false); }