Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ParenthesizedExpression.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  /// An expression surrounded by parenthesis.
11  /// </summary>
13  {
14  /// <summary>
15  /// Initializes a new instance of the <see cref="ParenthesizedExpression"/> class.
16  /// </summary>
18  {
19  }
20 
21  /// <summary>
22  /// Initializes a new instance of the <see cref="ParenthesizedExpression"/> class.
23  /// </summary>
24  /// <param name="content">The content.</param>
25  public ParenthesizedExpression(params Expression[] content)
26  {
27  if (content != null)
28  {
29  if (content.Length == 1)
30  Content = content[0];
31  else
32  Content = new ExpressionList(content);
33  }
34  }
35 
36  #region Public Properties
37 
38  /// <summary>
39  /// Gets or sets the expression.
40  /// </summary>
41  /// <value>
42  /// The expression.
43  /// </value>
44  public Expression Content { get; set; }
45 
46  #endregion
47 
48  #region Public Methods
49 
50  /// <inheritdoc />
51  public override IEnumerable<Node> Childrens()
52  {
53  ChildrenList.Clear();
54  ChildrenList.Add(Content);
55  return ChildrenList;
56  }
57 
58  /// <inheritdoc />
59  public override string ToString()
60  {
61  return string.Format("({0})", string.Join(",", Content));
62  }
63 
64  #endregion
65  }
66 }
ParenthesizedExpression(params Expression[] content)
Initializes a new instance of the ParenthesizedExpression class.
An expression surrounded by parenthesis.
ParenthesizedExpression()
Initializes a new instance of the ParenthesizedExpression class.
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes