Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ClassIdentifierGeneric.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 using System.Text;
5 
6 using SiliconStudio.Shaders.Ast;
7 
8 namespace SiliconStudio.Paradox.Shaders.Parser.Ast
9 {
11  {
12  #region Constructors and Destructors
13 
14  /// <summary>
15  /// Initializes a new instance of the <see cref = "ClassIdentifierGeneric" /> class.
16  /// </summary>
18  {
19  Generics = new List<Variable>();
20  }
21 
22  #endregion
23 
24  #region Public Properties
25 
26  /// <summary>
27  /// Gets or sets the path.
28  /// </summary>
29  /// <value>
30  /// The path.
31  /// </value>
32  public List<Variable> Generics { get; set; }
33 
34  #endregion
35 
36  #region Public Methods
37 
38  /// <summary>
39  /// Gets the separator.
40  /// </summary>
41  public string Separator
42  {
43  get
44  {
45  return ",";
46  }
47  }
48 
49  public bool Equals(ClassIdentifierGeneric other)
50  {
51  if (ReferenceEquals(null, other)) return false;
52  if (ReferenceEquals(this, other)) return true;
53 
54  return base.Equals(other) && (Generics.Count != other.Generics.Count);
55  }
56 
57  /// <inheritdoc/>
58  public override bool Equals(object obj)
59  {
60  if (ReferenceEquals(null, obj)) return false;
61  if (ReferenceEquals(this, obj)) return true;
62  return Equals(obj as ClassIdentifierGeneric);
63  }
64 
65  /// <inheritdoc/>
66  public override int GetHashCode()
67  {
68  unchecked
69  {
70  return (base.GetHashCode() * 397) ^ Generics.GetHashCode();
71  }
72  }
73 
74  /// <inheritdoc />
75  public override IEnumerable<Node> Childrens()
76  {
77  return Generics;
78  }
79 
80  /// <inheritdoc />
81  public override string ToString()
82  {
83  var ranks = new StringBuilder();
84  if (Indices != null)
85  {
86  foreach (var expression in Indices)
87  {
88  ranks.Append("[").Append(expression).Append("]");
89  }
90  }
91 
92  return string.Format(IsSpecialReference ? "{0}<{1}{2}>" : "{0}{1}{2}", Text, string.Join(Separator, Generics), ranks);
93  }
94 
95  #endregion
96  }
97 }
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
ClassIdentifierGeneric()
Initializes a new instance of the ClassIdentifierGeneric class.