Antlr4.Runtime.Dfa.DFAState.Equals C# (CSharp) Метод

Equals() публичный Метод

Two DFAState instances are equal if their ATN configuration sets are the same. This method is used to see if a state already exists.

Because the number of alternatives and number of ATN configurations are finite, there is a finite number of DFA states that can be processed. This is necessary to show that the algorithm terminates.

Cannot test the DFA state numbers here because in Antlr4.Runtime.Atn.ParserATNSimulator.AddDFAState(DFA, Antlr4.Runtime.Atn.ATNConfigSet, Antlr4.Runtime.Atn.PredictionContextCache) we need to know if any other state exists that has this exact set of ATN configurations. The stateNumber is irrelevant.

public Equals ( object o ) : bool
o object
Результат bool
        public override bool Equals(object o)
        {
            // compare set of ATN configurations in this set with other
            if (this == o)
            {
                return true;
            }
            if (!(o is DFAState))
            {
                return false;
            }
            DFAState other = (DFAState)o;
            bool sameSet = this.configs.Equals(other.configs);
            //		System.out.println("DFAState.equals: "+configs+(sameSet?"==":"!=")+other.configs);
            return sameSet;
        }