public override bool Equals(object obj) { if (!(obj is ConstantList)) { return(false); } ConstantList other = (ConstantList)obj; if (this.list.Count != other.list.Count) { return(false); } List <Constant> myList = this.list.ToList <Constant>(); List <Constant> otherList = other.list.ToList <Constant>(); for (int i = 0; i < myList.Count; i++) { if (!myList[i].Equals(otherList[i])) { return(false); } } return(true); }
private static string ToDot(string parent, ConstantList node) { string name = String.Format("ConstantList{0}", counter++); foreach (Constant item in node) { string itemName = ToDot(name, item); text.AppendFormat(" {0} -> {1};\n", name, itemName); } return(name); }
/// <summary> /// Build a <see cref="AST.ConstantList"/> from the given <see cref="AST.Constant"/>s. /// </summary> /// <param name="constants">Series of <see cref="AST.Constant"/>s.</param> /// <returns>Returns a <see cref="AST.ConstantList"/> containing the given <see cref="AST.Constant"/>s.</returns> public static ConstantList ConstantList(params Constant[] constants) { ConstantList list = new ConstantList(); foreach (Constant item in constants) { list.AddLast(item); } return(list); }