Antlr4.Runtime.Sharpen.BitSet.Get C# (CSharp) Method

Get() public method

public Get ( int index ) : bool
index int
return bool
        public bool Get(int index)
        {
            if (index < 0)
                throw new ArgumentOutOfRangeException("index");

            int element = index / BitsPerElement;
            if (element >= _data.Length)
                return false;

            return (_data[element] & (1UL << (index % BitsPerElement))) != 0;
        }

Usage Example

Example #1
0
 private static bool TestTailCall(ATN atn, RuleTransition transition, bool optimizedPath)
 {
     if (!optimizedPath && transition.tailCall)
     {
         return true;
     }
     if (optimizedPath && transition.optimizedTailCall)
     {
         return true;
     }
     BitSet reachable = new BitSet(atn.states.Count);
     Stack<ATNState> worklist = new Stack<ATNState>();
     worklist.Push(transition.followState);
     while (worklist.Count > 0)
     {
         ATNState state = worklist.Pop();
         if (reachable.Get(state.stateNumber))
         {
             continue;
         }
         if (state is RuleStopState)
         {
             continue;
         }
         if (!state.OnlyHasEpsilonTransitions)
         {
             return false;
         }
         IList<Transition> transitions = optimizedPath ? state.optimizedTransitions : state.transitions;
         foreach (Transition t in transitions)
         {
             if (t.TransitionType != TransitionType.EPSILON)
             {
                 return false;
             }
             worklist.Push(t.target);
         }
     }
     return true;
 }
All Usage Examples Of Antlr4.Runtime.Sharpen.BitSet::Get