/// <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.LoopBodyOwner == null))
     {
         IIteratorExp loopBodyOwnerCasted = item.As <IIteratorExp>();
         if ((loopBodyOwnerCasted != null))
         {
             this._parent.LoopBodyOwner = loopBodyOwnerCasted;
             return;
         }
     }
     if ((this._parent.AppliedElement == null))
     {
         ICallExp appliedElementCasted = item.As <ICallExp>();
         if ((appliedElementCasted != null))
         {
             this._parent.AppliedElement = appliedElementCasted;
             return;
         }
     }
     if ((this._parent.ParentCall == null))
     {
         IOperationCallExp parentCallCasted = item.As <IOperationCallExp>();
         if ((parentCallCasted != null))
         {
             this._parent.ParentCall = parentCallCasted;
             return;
         }
     }
 }
 public static string GenerateExpression(IOclExpression expression, bool useMetamodelInterface)
 {
     if (expression is IOperationCallExp)
     {
         IOperationCallExp value = (IOperationCallExp)expression;
         return("transformation.Functions." + value.ReferredOperation.Name + "(" + string.Join(",", value.Argument.Select(u => GenerateExpression(u, useMetamodelInterface))) + ")");
     }
     if (expression is CSharpOpaqueExpression)
     {
         CSharpOpaqueExpression value = (CSharpOpaqueExpression)expression;
         return(value.Code);
     }
     if (expression is IVariableExp)
     {
         return(((IVariableExp)expression).ReferredVariable.Name);
     }
     if (expression is Assignment)
     {
         Assignment assignment = (Assignment)expression;
         return(assignment.AssignedVariable.Type.GetRealTypeName() + " " + assignment.AssignedVariable.Name + " = " + GenerateExpression(assignment.Value, useMetamodelInterface));
     }
     if (expression is IRelationCallExp)
     {
         IRelationCallExp relationCallExp = (IRelationCallExp)expression;
         return("transformation." + QvtCodeGeneratorStrings.RelationClassName(relationCallExp.ReferredRelation)
                + ".CheckAndEnforce(" + string.Join(",", relationCallExp.Argument.Select(u => GenerateExpression(u, useMetamodelInterface))) + ")");
     }
     throw new CodeGeneratorException("Cannot manage expression: " + expression);
 }