Generic Interpreter 1.2
Private API

gi
Class Lexicon.Stack

java.lang.Object
  extended bygi.Lexicon.Stack
Direct Known Subclasses:
Lexicon.Set
Enclosing class:
Lexicon

static class Lexicon.Stack
extends Object

This class implements a Stack.

Version:
1.2
Author:
© 1999-2004 Craig A. Rich <carich@csupomona.edu>

Field Summary
(package private)  Object[] get
          The objects on this Stack.
(package private)  int size
          The number of objects on this Stack.
 
Constructor Summary
(package private) Lexicon.Stack(int capacity)
          Constructs a Stack with an initial capacity.
 
Method Summary
(package private)  Object pop()
          Pops and returns the top object of this Stack.
(package private)  boolean push(Object object)
          Pushes an object onto this Stack.
(package private)  Object top()
          Returns the top object of this Stack.
 String toString()
          Returns the string representation of this Stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

get

Object[] get

The objects on this Stack.


size

int size

The number of objects on this Stack.

Constructor Detail

Lexicon.Stack

Lexicon.Stack(int capacity)

Constructs a Stack with an initial capacity.

Parameters:
capacity - the initial capacity.
Method Detail

pop

Object pop()

Pops and returns the top object of this Stack.

Returns:
the top object of this Stack.

push

boolean push(Object object)

Pushes an object onto this Stack. The capacity is expanded by 50% if necessary.

Parameters:
object - the object to push onto this Stack.
Returns:
true indicates this Stack is changed.

top

Object top()

Returns the top object of this Stack.

Returns:
the top object of this Stack.

toString

public String toString()

Returns the string representation of this Stack.

Returns:
the string representation of this Stack.

 

© 1999-2004 Craig A. Rich <carich@csupomona.edu>