org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T > Class Reference

Inheritance diagram for org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >:

Inheritance graph
[legend]

List of all members.

Public Member Functions

void reset ()
void clear ()
remove ()
void add (T o)
int size ()
int range ()
head ()
elementAt (int i)
String toString ()

Protected Attributes

List< T > data = new ArrayList<T>()
int p = 0
int range = -1


Detailed Description

A queue that can dequeue and get(i) in O(1) and grow arbitrarily large. A linked list is fast at dequeue but slow at get(i). An array is the reverse. This is O(1) for both operations.

List grows until you dequeue last element at end of buffer. Then it resets to start filling at 0 again. If adds/removes are balanced, the buffer will not grow too large.

No iterator stuff as that's not how we'll use it.

Definition at line 44 of file FastQueue.java.


Member Function Documentation

void org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.reset (  ) 

void org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.clear (  ) 

Definition at line 52 of file FastQueue.java.

T org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.remove (  ) 

Get and remove first element in queue

Reimplemented in org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.

Definition at line 55 of file FastQueue.java.

void org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.add ( o  ) 

Definition at line 66 of file FastQueue.java.

int org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.size (  ) 

int org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.range (  ) 

Definition at line 70 of file FastQueue.java.

T org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.head (  ) 

Definition at line 72 of file FastQueue.java.

T org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.elementAt ( int  i  ) 

Return element i elements ahead of current element. i==0 gets current element. This is not an absolute index into the data list since p defines the start of the real list.

Definition at line 78 of file FastQueue.java.

String org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.toString (  ) 

Return string of current buffer contents; non-destructive

Definition at line 91 of file FastQueue.java.


Member Data Documentation

List<T> org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.data = new ArrayList<T>() [protected]

dynamically-sized buffer of elements

Definition at line 46 of file FastQueue.java.

int org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.p = 0 [protected]

index of next element to fill

Definition at line 48 of file FastQueue.java.

int org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.range = -1 [protected]

Definition at line 49 of file FastQueue.java.


The documentation for this class was generated from the following file:

Generated on Tue Jul 19 11:42:08 2011 for ANTLR API by  doxygen 1.5.5