예제 #1
0
        //***************************************************************************
        // Public Methods
        // 
        /// <summary>
        /// Adds a statement to this DynaMember object.
        /// </summary>
        /// <param name="newStatement">An DynaStatement object containing the expression you want to add.</param>
        public void AddStatement(DynaStatement value)
        {
            #region DEBUG Output
#if DEBUG
            Console.WriteLine(value.GetType().Name);
#endif
            #endregion
            switch (value.GetType().Name.ToLower())
            {
                case "dynaiterationstatement":
                    csc.Add((value as DynaIterationStatement).Statement);
                    break;
                case "dynaassignmentstatement":
                    csc.Add((value as DynaAssignmentStatement).Statement);
                    break;
                case "dynaconditionstatement":
                    csc.Add((value as DynaConditionStatement).Statement);
                    break;
                case "dynareturnstatement":
                    csc.Add((value as DynaReturnStatement).Statement);
                    break;
                case "dynadeclarationstatement":
                    csc.Add((value as DynaDeclarationStatement).Statement);
                    break;
                case "dynacommentstatement":
                    csc.Add((value as DynaCommentStatement).Statement);
                    break;
                case "dynamethodexpression":
                    csc.Add((value as DynaMethodExpression).Statement);
                    break;
                case "dynaarraycreateexpression":
                    csc.Add((value as DynaArrayCreateExpression).Statement);
                    break;
                case "dynaarrayindexerexpression":
                    csc.Add((value as DynaArrayIndexerExpression).Statement);
                    break;
                case "dynaoperatorexpression":
                    csc.Add((value as DynaOperatorExpression).Statement);
                    break;
            }
            #region DEBUG Output
#if DEBUG
            Console.WriteLine(csc[csc.Count - 1].ToString());
#endif
            #endregion
        }
 public void SetValueIncrement(DynaStatement value)
 {
     switch (value.GetType().Name.ToLower())
     {
         case "dynaiterationstatement":
             this._valueInc = (value as DynaIterationStatement).Statement;
             break;
         case "dynaassignmentstatement":
             this._valueInc = (value as DynaAssignmentStatement).Statement;
             break;
         case "dynaconditionstatement":
             this._valueInc = (value as DynaConditionStatement).Statement;
             break;
         case "dynareturnstatement":
             this._valueInc = (value as DynaReturnStatement).Statement;
             break;
         case "dynadeclarationstatement":
             this._valueInc = (value as DynaDeclarationStatement).Statement;
             break;
         case "dynacommentstatement":
             this._valueInc = (value as DynaCommentStatement).Statement;
             break;
     }
 }
 /// <summary>
 /// Adds a statement expression to be executed if the condition statement evaluates to false.
 /// </summary>
 /// <param name="expr">An object inherited from the AllOneSystem.DynaCode.DynaStatement class.</param>
 public void AddElseStatement(DynaStatement value)
 {
     switch (value.GetType().Name.ToLower())
     {
         case "dynaiterationstatement":
             csc2.Add((value as DynaIterationStatement).Statement);
             break;
         case "dynaassignmentstatement":
             csc2.Add((value as DynaAssignmentStatement).Statement);
             break;
         case "dynaconditionstatement":
             csc2.Add((value as DynaConditionStatement).Statement);
             break;
         case "dynareturnstatement":
             csc2.Add((value as DynaReturnStatement).Statement);
             break;
         case "dynadeclarationstatement":
             csc2.Add((value as DynaDeclarationStatement).Statement);
             break;
         case "dynacommentstatement":
             csc2.Add((value as DynaCommentStatement).Statement);
             break;
         case "dynamethodexpression":
             csc2.Add((value as DynaMethodExpression).Statement);
             break;
         case "dynaarraycreateexpression":
             csc2.Add((value as DynaArrayCreateExpression).Statement);
             break;
         case "dynaarrayindexerexpression":
             csc2.Add((value as DynaArrayIndexerExpression).Statement);
             break;
         case "dynaoperatorexpression":
             csc2.Add((value as DynaOperatorExpression).Statement);
             break;
     }
 }
 public DynaIterationStatement(DynaStatement InitValue, DynaExpression LoopCondition, DynaStatement ValueIncrement, DynaStatement[] LoopStatements)
 {
     switch (InitValue.GetType().Name.ToLower())
     {
         case "dynaiterationstatement":
             this._initValue = (InitValue as DynaIterationStatement).Statement;
             break;
         case "dynaassignmentstatement":
             this._initValue = (InitValue as DynaAssignmentStatement).Statement;
             break;
         case "dynaconditionstatement":
             this._initValue = (InitValue as DynaConditionStatement).Statement;
             break;
         case "dynareturnstatement":
             this._initValue = (InitValue as DynaReturnStatement).Statement;
             break;
         case "dynadeclarationstatement":
             this._initValue = (InitValue as DynaDeclarationStatement).Statement;
             break;
         case "dynacommentstatement":
             this._initValue = (InitValue as DynaCommentStatement).Statement;
             break;
     }
     switch (LoopCondition.GetType().Name.ToLower())
     {
         case "dynamethodexpression":
             this._testCondition = (LoopCondition as DynaMethodExpression).Expression;
             break;
         case "dynaarraycreateexpression":
             this._testCondition = (LoopCondition as DynaArrayCreateExpression).Expression;
             break;
         case "dynaarrayindexerexpression":
             this._testCondition = (LoopCondition as DynaArrayIndexerExpression).Expression;
             break;
         case "dynaoperatorexpression":
             this._testCondition = (LoopCondition as DynaOperatorExpression).Expression;
             break;
     }
     switch (ValueIncrement.GetType().Name.ToLower())
     {
         case "dynaiterationstatement":
             this._valueInc = (ValueIncrement as DynaIterationStatement).Statement;
             break;
         case "dynaassignmentstatement":
             this._valueInc = (ValueIncrement as DynaAssignmentStatement).Statement;
             break;
         case "dynaconditionstatement":
             this._valueInc = (ValueIncrement as DynaConditionStatement).Statement;
             break;
         case "dynareturnstatement":
             this._valueInc = (ValueIncrement as DynaReturnStatement).Statement;
             break;
         case "dynadeclarationstatement":
             this._valueInc = (ValueIncrement as DynaDeclarationStatement).Statement;
             break;
         case "dynacommentstatement":
             this._valueInc = (ValueIncrement as DynaCommentStatement).Statement;
             break;
     }
     if (LoopStatements != null)
     {
         foreach (DynaStatement ds in LoopStatements)
             switch (ds.GetType().Name.ToLower())
             {
                 case "dynaiterationstatement":
                     csc.Add((ds as DynaIterationStatement).Statement);
                     break;
                 case "dynaassignmentstatement":
                     csc.Add((ds as DynaAssignmentStatement).Statement);
                     break;
                 case "dynaconditionstatement":
                     csc.Add((ds as DynaConditionStatement).Statement);
                     break;
                 case "dynareturnstatement":
                     csc.Add((ds as DynaReturnStatement).Statement);
                     break;
                 case "dynadeclarationstatement":
                     csc.Add((ds as DynaDeclarationStatement).Statement);
                     break;
                 case "dynacommentstatement":
                     csc.Add((ds as DynaCommentStatement).Statement);
                     break;
             }
     }
 }