Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ForEachStatement.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.Collections.Generic;
4 
5 using SiliconStudio.Shaders.Ast;
6 
7 namespace SiliconStudio.Paradox.Shaders.Parser.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>
20  {
21  }
22 
23  /// <summary>
24  /// Initializes a new instance of the <see cref="ForEachStatement"/> class.
25  /// </summary>
26  /// <param name="variable">The variable.</param>
27  /// <param name="collection">The collection.</param>
28  public ForEachStatement(Variable variable, Expression collection)
29  {
30  Variable = variable;
31  Collection = collection;
32  }
33 
34  #endregion
35 
36  #region Public Properties
37 
38  /// <summary>
39  /// Gets or sets the condition.
40  /// </summary>
41  /// <value>
42  /// The condition.
43  /// </value>
44  public Expression Collection { get; set; }
45 
46  /// <summary>
47  /// Gets or sets the initializer.
48  /// </summary>
49  /// <value>
50  /// The initializer.
51  /// </value>
52  public Variable Variable { get; set; }
53 
54  /// <summary>
55  /// Gets or sets the condition.
56  /// </summary>
57  /// <value>
58  /// The condition.
59  /// </value>
60  public Statement Body { get; set; }
61 
62  #endregion
63 
64  #region Public Methods
65 
66  /// <inheritdoc />
67  public override IEnumerable<Node> Childrens()
68  {
69  ChildrenList.Clear();
70  ChildrenList.Add(Collection);
71  ChildrenList.Add(Variable);
72  ChildrenList.Add(Body);
73  return ChildrenList;
74  }
75 
76  /// <inheritdoc />
77  public override string ToString()
78  {
79  return string.Format("foreach({0} in {1}) {{...}}", Variable, Collection);
80  }
81 
82  #endregion
83  }
84 }
ForEachStatement(Variable variable, Expression collection)
Initializes a new instance of the ForEachStatement class.
ForEachStatement()
Initializes a new instance of the ForStatement class.
A tag interface to identify a container for scope declarations.
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
A variable declaration.
Definition: Variable.cs:11
Base root class for all statements.
Definition: Statement.cs:11