Package antlr

Class CharQueue

java.lang.Object
antlr.CharQueue

public class CharQueue extends Object
A circular buffer object used by CharBuffer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected char[]
    Physical circular buffer of tokens
    protected int
    number of tokens in the queue
  • Constructor Summary

    Constructors
    Constructor
    Description
    CharQueue(int minSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    append(char tok)
    Add token to end of the queue
    final char
    elementAt(int idx)
    Fetch a token from the queue by index
    void
    init(int size)
    Initialize the queue.
    final void
    Remove char from front of queue
    final void
    Clear the queue.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • buffer

      protected char[] buffer
      Physical circular buffer of tokens
    • nbrEntries

      protected int nbrEntries
      number of tokens in the queue
  • Constructor Details

    • CharQueue

      public CharQueue(int minSize)
  • Method Details

    • append

      public final void append(char tok)
      Add token to end of the queue
      Parameters:
      tok - The token to add
    • elementAt

      public final char elementAt(int idx)
      Fetch a token from the queue by index
      Parameters:
      idx - The index of the token to fetch, where zero is the token at the front of the queue
    • init

      public void init(int size)
      Initialize the queue.
      Parameters:
      size - The initial size of the queue
    • reset

      public final void reset()
      Clear the queue. Leaving the previous buffer alone.
    • removeFirst

      public final void removeFirst()
      Remove char from front of queue