using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sunweaver.Parsing { public class CoduleDefinition { public string identifier; public short desiredCoduleIndex; public Token coduleDefinitionToken; public List tokens = new List(); public override bool Equals(object obj) { if (obj is CoduleDefinition) { return Equals(obj as CoduleDefinition); } else { return false; } } public bool Equals(CoduleDefinition other) { return identifier.Equals(other.identifier) && desiredCoduleIndex.Equals(other.desiredCoduleIndex) && tokens.SequenceEqual(other.tokens) && ( (coduleDefinitionToken == null && other.coduleDefinitionToken == null) || (coduleDefinitionToken != null && coduleDefinitionToken.Equals(other.coduleDefinitionToken)) ); } public override int GetHashCode() { return base.GetHashCode(); } public override string ToString() { return identifier + "(" + (coduleDefinitionToken == null ? "null" : coduleDefinitionToken.ToString()) + ", " + desiredCoduleIndex + "): " + tokens.Aggregate("", (x, y) => x += " \n" + y.ToString()); } } }