/// <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) { IRelationImplementation relationImplementationItem = item.As <IRelationImplementation>(); if (((relationImplementationItem != null) && this._parent.OperationalImpl.Remove(relationImplementationItem))) { return(true); } IVariable variableItem = item.As <IVariable>(); if (((variableItem != null) && this._parent.Variable.Remove(variableItem))) { return(true); } if ((this._parent.When == item)) { this._parent.When = null; return(true); } if ((this._parent.Where == item)) { this._parent.Where = null; 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(IModelElement item) { IRelationImplementation operationalImplCasted = item.As <IRelationImplementation>(); if ((operationalImplCasted != null)) { this._parent.OperationalImpl.Add(operationalImplCasted); } IVariable variableCasted = item.As <IVariable>(); if ((variableCasted != null)) { this._parent.Variable.Add(variableCasted); } if ((this._parent.When == null)) { IPattern whenCasted = item.As <IPattern>(); if ((whenCasted != null)) { this._parent.When = whenCasted; return; } } if ((this._parent.Where == null)) { IPattern whereCasted = item.As <IPattern>(); if ((whereCasted != null)) { this._parent.Where = whereCasted; return; } } }