
public class Discard {

	private Card discard[] = new Card[52] ;
	private int theLength  = 0 ;

	private Card emptyCard = new Card() ;



	public void pushCard ( Card aCard ) {
		discard[theLength++] = aCard ;
	}

	public Card popCard() {
		if ( isEmpty() )
			return emptyCard ;
		else
			return discard[--theLength] ;
	}

	public Card topCard() {
		if ( isEmpty() )
			return emptyCard ;
		else
			return discard[theLength-1] ;
	}

	public int getLength() {
		return theLength ;
	}

	public Card cardAt( int i ) {
		if ( ( 0 <= i ) && ( i < theLength ) )
			return discard[i] ;
		else
			return emptyCard ;
	}

	public boolean isEmpty() {
		if ( theLength > 0 )
			return false ;
		else
			return true ;
	}
}


