FileDocCategorySizeDatePackage
StackImpl.javaAPI DocJava SE 5 API1565Fri Aug 26 14:54:30 BST 2005com.sun.corba.se.impl.orbutil

StackImpl

public class StackImpl extends Object

Fields Summary
private Object[]
data
private int
top
Constructors Summary
Methods Summary
public final booleanempty()


    // Tests if this stack is empty.
        
	return top == -1;
    
private voidensure()

	if (top == (data.length-1)) {
	    int newSize = 2*data.length ;
	    Object[] newData = new Object[ newSize ] ;
	    System.arraycopy( data, 0, newData, 0, data.length ) ;
	    data = newData ;
	}
    
public final java.lang.Objectpeek()

	if (empty()) 
	    throw new EmptyStackException();

	return data[ top ];
    
public final java.lang.Objectpop()

	Object obj = peek() ;
	data[top] = null ;
	top-- ;
	return obj;
    
public final java.lang.Objectpush(java.lang.Object item)

	ensure() ;
	top++ ;
	data[top] = item;
	return item;