Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SwitchStatement.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  /// Switch statement.
11  /// </summary>
12  public class SwitchStatement : Statement
13  {
14  /// <summary>
15  /// Initializes a new instance of the <see cref="SwitchStatement"/> class.
16  /// </summary>
17  public SwitchStatement()
18  {
19  Groups = new List<SwitchCaseGroup>();
20  }
21 
22  #region Public Properties
23 
24  /// <summary>
25  /// Gets or sets the condition.
26  /// </summary>
27  /// <value>
28  /// The condition.
29  /// </value>
30  public Expression Condition { get; set; }
31 
32  /// <summary>
33  /// Gets or sets the cases.
34  /// </summary>
35  /// <value>
36  /// The cases.
37  /// </value>
38  public List<SwitchCaseGroup> Groups { 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.AddRange(Groups);
50  return ChildrenList;
51  }
52 
53  /// <inheritdoc />
54  public override string ToString()
55  {
56  return string.Format("switch ({0}) {{...}}", Condition);
57  }
58 
59  #endregion
60  }
61 }
SwitchStatement()
Initializes a new instance of the SwitchStatement class.
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
Base root class for all statements.
Definition: Statement.cs:11