Antlr3.Analysis.DFAState.Equals C# (CSharp) Method

Equals() public method

public Equals ( object o ) : bool
o object
return bool
        public override bool Equals( object o )
        {
            // compare set of NFA configurations in this set with other
            DFAState other = o as DFAState;
            if (other == null)
                return false;

            if ( object.ReferenceEquals( _nfaConfigurations, other._nfaConfigurations ) )
                return true;

            if ( this._nfaConfigurations.Equals( other._nfaConfigurations ) )
                return true;

            if ( _nfaConfigurations.SequenceEqual( other._nfaConfigurations ) )
                return true;

            return false;
        }

Usage Example

Beispiel #1
0
        public List <DFAState> GetAnyDFAPathToTarget(DFAState startState, DFAState targetState, HashSet <DFAState> visited)
        {
            List <DFAState> dfaStates = new List <DFAState>();

            visited.Add(startState);
            if (startState.Equals(targetState))
            {
                dfaStates.Add(targetState);
                return(dfaStates);
            }
            // for (Edge e : startState.edges) { // walk edges looking for valid
            // path
            for (int i = 0; i < startState.NumberOfTransitions; i++)
            {
                Transition e = startState.GetTransition(i);
                if (!visited.Contains((DFAState)e.Target))
                {
                    List <DFAState> path = GetAnyDFAPathToTarget((DFAState)e.Target, targetState, visited);
                    if (path != null)
                    { // found path, we're done
                        dfaStates.Add(startState);
                        dfaStates.AddRange(path);
                        return(dfaStates);
                    }
                }
            }
            return(null);
        }
All Usage Examples Of Antlr3.Analysis.DFAState::Equals