Package antlr.collections.impl
Class LList
- java.lang.Object
-
- antlr.collections.impl.LList
-
-
Constructor Summary
Constructors Constructor Description LList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Object o)
Add an object to the end of the list.void
append(Object o)
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)
Get the ith element in the list.Enumeration
elements()
Return an enumeration of the list elementsint
height()
How high is the stack?boolean
includes(Object o)
Answers whether or not an object is contained in the listprotected void
insertHead(Object o)
Insert an object at the head of the list.int
length()
Return the length of the list.Object
pop()
Pop the top element of the stack off.void
push(Object o)
Push an object onto the stack.Object
top()
-
-
-
Method Detail
-
add
public void add(Object o)
Add an object to the end of the list.
-
append
public void append(Object o)
Append an object to the end of the list.
-
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.
- Throws:
NoSuchElementException
- if the list is empty.
-
elementAt
public Object elementAt(int i) throws NoSuchElementException
Get the ith element in the list.- Specified by:
elementAt
in interfaceList
- Parameters:
i
- the index (from 0) of the requested element.- Returns:
- the object at index i NoSuchElementException is thrown if i out of range
- Throws:
NoSuchElementException
-
elements
public Enumeration elements()
Return an enumeration of the list elements
-
includes
public boolean includes(Object o)
Answers whether or not an object is contained in the list
-
insertHead
protected void insertHead(Object o)
Insert an object at the head of the list.- Parameters:
o
- the object to add
-
pop
public Object pop() throws NoSuchElementException
Pop the top element of the stack off.- Specified by:
pop
in interfaceStack
- Returns:
- the top of stack that was popped off.
- Throws:
NoSuchElementException
- if the stack is empty.
-
push
public void push(Object o)
Push an object onto the stack.
-
top
public Object top() throws NoSuchElementException
- Specified by:
top
in interfaceStack
- Throws:
NoSuchElementException
-
-