public override int GetHashCode() { int hashCode = 5; hashCode = 7 * hashCode + (obj != null ? obj.GetHashCode() : 0); hashCode = 7 * hashCode + value; return(hashCode); }
private bool Equals(Antlr4.Runtime.Atn.ArrayPredictionContext other, HashSet <PredictionContextCache.IdentityCommutativePredictionContextOperands > visited) { Stack <PredictionContext> selfWorkList = new Stack <PredictionContext>(); Stack <PredictionContext> otherWorkList = new Stack <PredictionContext>(); selfWorkList.Push(this); otherWorkList.Push(other); while (selfWorkList.Count > 0) { PredictionContextCache.IdentityCommutativePredictionContextOperands operands = new PredictionContextCache.IdentityCommutativePredictionContextOperands(selfWorkList .Pop(), otherWorkList.Pop()); if (!visited.Add(operands)) { continue; } int selfSize = operands.X.Size; if (selfSize == 0) { if (!operands.X.Equals(operands.Y)) { return(false); } continue; } int otherSize = operands.Y.Size; if (selfSize != otherSize) { return(false); } for (int i = 0; i < selfSize; i++) { if (operands.X.GetReturnState(i) != operands.Y.GetReturnState(i)) { return(false); } PredictionContext selfParent = operands.X.GetParent(i); PredictionContext otherParent = operands.Y.GetParent(i); if (selfParent.GetHashCode() != otherParent.GetHashCode()) { return(false); } if (selfParent != otherParent) { selfWorkList.Push(selfParent); otherWorkList.Push(otherParent); } } } return(true); }
public override int GetHashCode() { return(x.GetHashCode() ^ y.GetHashCode()); }