solitaire
Interface IGuiPileModel


public interface IGuiPileModel

Simple interface for real views to implement. The view set by a model's setView method should be stored and then updated (call the view's update method) when the model changes.

A model should store an id that can be anything, but might be used in a program to represent specific pile-models, e.g., "t1" or "c1" or "f3" in Freecell.

The number of cards visible in a model might be one for a foundation pile in Freecell even when the pile/model stores six cards. The max number of cards visible in such a pile/model should be one, there will only be one visible card as well.

The relationship between maximal number of displayed cards and real number of visible cards is pretty kludgey and the max idea should ultimately disappear when GUI code reaches version 1.0


Method Summary
 java.lang.String getPileID()
          Return a unique id for a pile, e.g., "t1", "f1".
 IGuiCard getVisibleCard(int index)
          Return the ith visible card.
 int maxVisibleCount()
          Return the maximum number of cards that can be displayed.
 void setView(GuiPileView view)
          Set view for a pile/model.
 int visibleCardCount()
          Number of cards visible (displayed) from the model.
 

Method Detail

setView

void setView(GuiPileView view)
Set view for a pile/model. When the model changes it should call the view's update method.

Parameters:
view - is the view "observing" this model

visibleCardCount

int visibleCardCount()
Number of cards visible (displayed) from the model.

Returns:
the number of cards that should be displayed

maxVisibleCount

int maxVisibleCount()
Return the maximum number of cards that can be displayed. This value is used in creating the GuiPilePanel objects and in redrawing them.

Returns:
the maximal number of displayed cards

getPileID

java.lang.String getPileID()
Return a unique id for a pile, e.g., "t1", "f1".

Returns:
a model/pile's unique id

getVisibleCard

IGuiCard getVisibleCard(int index)
Return the ith visible card. The index zero/0 is always the first/deepest visible card and the index visibleCardCount() is the last (all of it shown in a pile) card displayed. If there are only three cards visible, but a model stores eight, then index zero should get the card whose real index is 5, index one gets real index 6, and index two gets last/real index 7 card.

Cards can be visible and face down.

Parameters:
index - specifies which visible card obtained from model
Returns:
the visible card