/**
   A DoublyLinkedCard is a Card with links to the next and the previous 
   DoublyLinkedCard.

   @author Franck van Breugel
*/
public class DoublyLinkedCard extends Card
{
    private DoublyLinkedCard next;
    private DoublyLinkedCard prev;
    
    /**
       Construct a doubly linked card with the given attributes.

       @param suit the suit of the card.
       @pre. Card.HEARTS <= suit && suit <= Card.SPADES
       @param rank the rank of the card.
       @pre. 2 <= rank && rank <= Card.ACE
       @param next the link to the next card.
       @param prev the link to the next card.
    */
    public DoublyLinkedCard(int suit, int rank, DoublyLinkedCard next, DoublyLinkedCard prev)
    {
	super(suit, rank);
	this.next = next;
	this.prev = prev;
    }
    
    /**
       Return the link to the next card.
       
       @return the link to the next card.
    */
    public DoublyLinkedCard getNext()
    {
	return this.next;
    }

    /**
       Set the next card to the given card.

       @param next the new next card
    */
    public void setNext(DoublyLinkedCard next)
    {
	this.next = next;
    }

    /**
       Return the link to the prev card.
       
       @return the link to the prev card.
    */
    public DoublyLinkedCard getPrev()
    {
	return this.prev;
    }

    /**
       Set the previous card to the given card.

       @param next the new previous card.
    */
    public void setPrev(DoublyLinkedCard prev)
    {
	this.prev = prev;
    }
}
