/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.CaseExp == null)) { IExpression caseExpCasted = item.As <IExpression>(); if ((caseExpCasted != null)) { this._parent.CaseExp = caseExpCasted; return; } } if ((this._parent.ElseExp == null)) { IExpression elseExpCasted = item.As <IExpression>(); if ((elseExpCasted != null)) { this._parent.ElseExp = elseExpCasted; return; } } IWhenClause whenClausesCasted = item.As <IWhenClause>(); if ((whenClausesCasted != null)) { this._parent.WhenClauses.Add(whenClausesCasted); } }
/// <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) { if ((this._parent.CaseExp == item)) { this._parent.CaseExp = null; return(true); } if ((this._parent.ElseExp == item)) { this._parent.ElseExp = null; return(true); } IWhenClause whenClauseItem = item.As <IWhenClause>(); if (((whenClauseItem != null) && this._parent.WhenClauses.Remove(whenClauseItem))) { return(true); } return(false); }
public void Add(IWhenClause clause) { _whenClauses.Add(clause); }
public WhenClauseTests() { specWriter = new StringWriter(); whenClause = new WhenClause(specWriter); }