Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ForStatement.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections;
5 using System.Collections.Generic;
6 
7 namespace SiliconStudio.Shaders.Ast
8 {
9  /// <summary>
10  /// For statement.
11  /// </summary>
13  {
14  #region Constructors and Destructors
15 
16  /// <summary>
17  /// Initializes a new instance of the <see cref = "ForStatement" /> class.
18  /// </summary>
19  public ForStatement()
20  {
21  }
22 
23  /// <summary>
24  /// Initializes a new instance of the <see cref="ForStatement"/> class.
25  /// </summary>
26  /// <param name="start">
27  /// The start.
28  /// </param>
29  /// <param name="condition">
30  /// The condition.
31  /// </param>
32  /// <param name="next">
33  /// The next.
34  /// </param>
35  public ForStatement(Statement start, Expression condition, Expression next)
36  {
37  Start = start;
38  Condition = condition;
39  Next = next;
40  }
41 
42  #endregion
43 
44  #region Public Properties
45 
46  /// <summary>
47  /// Gets or sets the initializer.
48  /// </summary>
49  /// <value>
50  /// The initializer.
51  /// </value>
52  public Statement Start { get; set; }
53 
54  /// <summary>
55  /// Gets or sets the condition.
56  /// </summary>
57  /// <value>
58  /// The condition.
59  /// </value>
60  public Expression Condition { get; set; }
61 
62  /// <summary>
63  /// Gets or sets the next.
64  /// </summary>
65  /// <value>
66  /// The next.
67  /// </value>
68  public Expression Next { get; set; }
69 
70  /// <summary>
71  /// Gets or sets the body.
72  /// </summary>
73  /// <value>
74  /// The body.
75  /// </value>
76  public Statement Body { get; set; }
77 
78  #endregion
79 
80  #region Public Methods
81 
82  /// <inheritdoc />
83  public override IEnumerable<Node> Childrens()
84  {
85  ChildrenList.Clear();
86  ChildrenList.Add(Start);
87  ChildrenList.Add(Condition);
88  ChildrenList.Add(Next);
89  ChildrenList.Add(Body);
90  return ChildrenList;
91  }
92 
93  /// <inheritdoc />
94  public override string ToString()
95  {
96  return string.Format("for({0}{1};{2}) {{...}}", Start, Condition, Next);
97  }
98 
99  #endregion
100  }
101 }
ForStatement(Statement start, Expression condition, Expression next)
Initializes a new instance of the ForStatement class.
Definition: ForStatement.cs:35
A tag interface to identify a container for scope declarations.
Base root class for all statements.
Definition: Statement.cs:11
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
Definition: ForStatement.cs:83
ForStatement()
Initializes a new instance of the ForStatement class.
Definition: ForStatement.cs:19