antlr.collections.impl
Class LList

java.lang.Object
  |
  +--antlr.collections.impl.LList
All Implemented Interfaces:
List, Stack

public class LList
extends Object
implements List, Stack

Untamed: A Linked List Implementation (not thread-safe for simplicity) (adds to the tail) (has an enumeration)


Field Summary
protected  LLCell head
           
protected  int length
           
protected  LLCell tail
           
 
Constructor Summary
LList()
          Enabled:
 
Method Summary
 void add(Object o)
          Enabled: Add an object to the end of the list.
 void append(Object o)
          Enabled: Append an object to the end of the list.
protected  Object deleteHead()
          Delete the object at the head of the list.
 Object elementAt(int i)
          Enabled: Get the ith element in the list.
 Enumeration elements()
          Enabled: Return an enumeration of the list elements
 int height()
          Enabled: How high is the stack?
 boolean includes(Object o)
          Enabled: Answers whether or not an object is contained in the list
protected  void insertHead(Object o)
          Insert an object at the head of the list.
 int length()
          Enabled: Return the length of the list.
 Object pop()
          Enabled: Pop the top element of the stack off.
 void push(Object o)
          Enabled: Push an object onto the stack.
 Object top()
          Enabled:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

head

protected LLCell head

tail

protected LLCell tail

length

protected int length
Constructor Detail

LList

public LList()
Enabled:

Method Detail

add

public void add(Object o)
Enabled: Add an object to the end of the list.

Specified by:
add in interface List
Parameters:
o - the object to add

append

public void append(Object o)
Enabled: Append an object to the end of the list.

Specified by:
append in interface List
Parameters:
o - the object to append

deleteHead

protected Object deleteHead()
                     throws NoSuchElementException
Delete the object at the head of the list.

Returns:
the object found at the head of the list.
NoSuchElementException

elementAt

public Object elementAt(int i)
                 throws NoSuchElementException
Enabled: Get the ith element in the list.

Specified by:
elementAt in interface List
Parameters:
i - the index (from 0) of the requested element.
Returns:
the object at index i NoSuchElementException is thrown if i out of range
NoSuchElementException

elements

public Enumeration elements()
Enabled: Return an enumeration of the list elements

Specified by:
elements in interface List

height

public int height()
Enabled: How high is the stack?

Specified by:
height in interface Stack

includes

public boolean includes(Object o)
Enabled: Answers whether or not an object is contained in the list

Specified by:
includes in interface List
Parameters:
o - the object to test for inclusion.
Returns:
true if object is contained else false.

insertHead

protected void insertHead(Object o)
Insert an object at the head of the list.

Parameters:
o - the object to add

length

public int length()
Enabled: Return the length of the list.

Specified by:
length in interface List

pop

public Object pop()
           throws NoSuchElementException
Enabled: Pop the top element of the stack off.

Specified by:
pop in interface Stack
Returns:
the top of stack that was popped off.
NoSuchElementException

push

public void push(Object o)
Enabled: Push an object onto the stack.

Specified by:
push in interface Stack
Parameters:
o - the object to push

top

public Object top()
           throws NoSuchElementException
Enabled:

Specified by:
top in interface Stack
NoSuchElementException


comments?