4 using System.Collections;
5 using System.Collections.Generic;
9 namespace SiliconStudio.Shaders.Ast
16 #region Constructors and Destructors
23 Dimensions =
new List<Expression>();
34 Dimensions =
new List<Expression>();
35 Dimensions.AddRange(dimensions);
40 #region Public Properties
48 public List<Expression> Dimensions {
get; set; }
53 var indices =
new StringBuilder();
54 foreach (var index
in Dimensions)
56 indices.Append(
"[").Append(index).Append(
"]");
59 return string.Format(
"{0}{1}", Type, indices);
76 public bool IsDimensionEmpty
78 get {
return Dimensions.Count == 1 && Dimensions[0] is
EmptyExpression; }
83 #region Public Methods
87 if (ReferenceEquals(null, other))
return false;
88 if (ReferenceEquals(
this, other))
return true;
90 if ( !base.Equals(other) || !Equals(other.
Type.
ResolveType(), Type.ResolveType()) || other.Dimensions.Count != Dimensions.Count)
return false;
93 return !Dimensions.Where((t, i) => t != other.
Dimensions[i]).Any();
96 public override bool Equals(
object obj)
98 if (ReferenceEquals(null, obj))
return false;
99 if (ReferenceEquals(
this, obj))
return true;
107 int result = base.GetHashCode();
108 result = (result * 397) ^ (Dimensions != null ? Dimensions.GetHashCode() : 0);
109 result = (result * 397) ^ (Type != null ? Type.GetHashCode() : 0);
116 return Equals(left, right);
121 return !Equals(left, right);
ArrayType(TypeBase type, params Expression[] dimensions)
Initializes a new instance of the ArrayType class.
virtual TypeBase ResolveType()
Resolves the type.
bool Equals(ArrayType other)
override string ToString()
ArrayType()
Initializes a new instance of the ArrayType class.
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
override bool Equals(object obj)
override int GetHashCode()
List< Expression > Dimensions
Gets or sets the dimensions.
TypeBase Type
Gets or sets the type.