Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
IfStatement.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  /// If statement.
11  /// </summary>
12  public class IfStatement : Statement
13  {
14  #region Public Properties
15 
16  /// <summary>
17  /// Gets or sets the condition.
18  /// </summary>
19  /// <value>
20  /// The condition.
21  /// </value>
22  public Expression Condition { get; set; }
23 
24  /// <summary>
25  /// Gets or sets the else.
26  /// </summary>
27  /// <value>
28  /// The else.
29  /// </value>
30  public Statement Else { get; set; }
31 
32  /// <summary>
33  /// Gets or sets the then.
34  /// </summary>
35  /// <value>
36  /// The then.
37  /// </value>
38  public Statement Then { get; set; }
39 
40  #endregion
41 
42  #region Public Methods
43 
44  /// <inheritdoc />
45  public override IEnumerable<Node> Childrens()
46  {
47  ChildrenList.Clear();
48  ChildrenList.Add(Condition);
49  ChildrenList.Add(Then);
50  ChildrenList.Add(Else);
51  return ChildrenList;
52  }
53 
54  /// <inheritdoc />
55  public override string ToString()
56  {
57  return string.Format("if ({0}) then {{...}}{1}", Condition, Else == null ? string.Empty : "...");
58  }
59 
60  #endregion
61  }
62 }
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
Definition: IfStatement.cs:45
Base root class for all statements.
Definition: Statement.cs:11