\documentclass[titlepage,a4paper]{article}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{makeidx}
\author{Sebastian 'spax' Pape}
\title{MemoSet class reference
\thanks{thanks to Till Sch\"ummer and Peter Tandler for their support}
}
\date{December 5th, 2002}
\makeindex
\begin{document}
\pagestyle{headings}
\maketitle
\tableofcontents

\section{MemoSetApplicationModel}
\index{MemoSetApplicationModel}
inherits from: \texttt{CoastApplicationModel} and provides some methods for accessing the MemoSetGame.
\index{CoastApplicationModel}
\index{MemoSetGame}
	\paragraph{slots:}
	\begin{itemize}
		\item[game] (type: singleValue) - just a reference to the actual MemoSetGame instance
\index{MemoSetGame}
	\end{itemize}

	\subsection{methods}
		\subsubsection{class}
		
	\paragraph{instance creation}
		\subparagraph{newInCluster: aCluster cardType: aMemoSetCardSubclass} calls self newInCluster: aCluster which is inherited from the CoastApplicationModel and requires aMemoSetCardSubclass which is used to determine the game type. This method actually creates the game instance.
\index{MemoSetCard}

		\subsubsection{instance}
		
	\paragraph{accessing}
		\subparagraph{game} a simple access method
		\subparagraph{game: aMemoSetGame} a simple access method
\index{MemoSetGame}		
	\paragraph{views}
		\subparagraph{localApplicationModelClass} returns the local application model class
\index{MemoSetLocalApplicationModel}

\section{MemoSetCard}
\index{MemoSetCard}
inherits from: \texttt{CoastModel} and is only an abstract class. It implements some general methods which are used for selecting and deselecting cards.
\index{CoastModel}
	\paragraph{slots}
	\begin{itemize}
		\item[container] (type: singleValue) - the card should know who owns it. Container is a MemoSetUser if the card is taken or a MemoSetGame if it is still in play.
\index{MemoSetUser}
\index{MemoSetGame}
		\item[selected] (type: set) - the card should know by which users it is selected.
\index{MemoSetUser}
	\end{itemize}
		
	\subsection{methods}
	
		\subsubsection{class}		
	\paragraph{constants}
\label{numberOfCardsNeededForSet}
		\subparagraph{numberOfCardsNeededForSet} This method should return an Integer value how many cards are needed for a complete set. Due to the reason \texttt{MemoSetCard} is an abstract class, it is the subclasses' responsibility to implement this method.
		\subparagraph{isGameCardClass} should return \texttt{true} if the class is a "real" card class
	\paragraph{instance creation}
		\subparagraph{createSetWithAllCards} This is not a normal implementation of instance creation, because you do not need only one card and you don't know which cards really exist outside. So here the method returns all possible cards in a set.Due to the reason \texttt{MemoSetCard} is an abstract class, it is the subclasses' responsibility to implement this method.
	
		\subsubsection{instance}
	\paragraph{accessing}
		\subparagraph{clickedByUser} select or deselect the card and test if the user has marked a set. Do some simple verification.
\index{MemoSetUser}
		\subparagraph{container} a simple acces method to the container slot
		\subparagraph{container: aGameOrUser} a simple acces method to the container slot
\index{MemoSetUser}
\index{MemoSetGame}		
		\subparagraph{delesectByAllUsers} deselects the card by all users
		\subparagraph{numberOfCardsNeededForSet} just an interface to ask the class
		\subparagraph{scoreForSet: aSet} should return the score for a given set. Due to the reason \texttt{MemoSetCard} is an abstract class, it is the subclasses' responsibility to implement this method.
\label{selectedBy}	
		\subparagraph{selectedBy} returns a Collection with the users which currently selected this card
	\paragraph{default}
		\subparagraph{defaultViewClass} return the view class for this kind of card. Due to the reason \texttt{MemoSetCard} is an abstract class, it is the subclasses' responsibility to implement this method.
	\paragraph{testing}
		\subparagraph{isASet: aList} The method gets a list with \texttt{self class numberOfCardsNeededForSet} (see \ref{numberOfCardsNeededForSet}) elements and decide if it is a valid set. Due to the reason \texttt{MemoSetCard} is an abstract class, it is the subclasses' responsibility to implement this method.
		\subparagraph{isSelected} returns true if \texttt{self selectedBy} is empty (see \ref{selectedBy}).
	\paragraph{private accessing}
		\subparagraph{deselectByUser: aUser} deselects the card for a given \texttt{MemoSetUser}.
\index{MemoSetUser}		
		\subparagraph{selectByUser: aUser} selects the card for a given \texttt{MemoSetUser}.
\index{MemoSetUser}
		
	\subsection{subclasses}
		\subsubsection{overview}
		\includegraphics{MemoSetCardInherit.eps}
		\subsubsection{MemoSetEmptyCard}
\index{MemoSetEmptyCard}		
		inherits from: \texttt{MemoSetCard} and is a template for empty card slots. Therefore it isn't a GameCardClass, too.
\index{MemoSetCard}		
	\paragraph{slots} This class owns only inherited slots.
	\paragraph{class methods}
		\subparagraph{numberOfCardsNeededForSet(constants)} An empty card does not need any other cards for a set: Therefore return always: \texttt{0}.
		\subparagraph{createSetWithAllCards(instance creation)} Return a set with exactly one empty card.
	
	\paragraph{instance methods}
		\subparagraph{clickedByUser: aUser (accessing)} just do nothing. An empty card can not be selected.
\index{MemoSetUser}		
		\subparagraph{scoreForSet: aSet (accessing)} an empty card scores \texttt{0}.
		\subparagraph{defaultViewClass(default)} returns the \texttt{MemoSetEmptyCardView class}.
\index{MemoSetEmptyCardView}		
		\subparagraph{isASet: aList (testing)} An empty card is never a set. Therefore return always: \texttt{false}.
			
		\subsubsection{MemoSetSetCard}
\index{MemoSetSetCard}		
		inherits from: \texttt{MemoSetCard} and implements the original Set cards.
\index{MemoSetCard}		
	\paragraph{slots:} This class owns additional slots which characterize the cards.
	\begin{itemize}
		\item[color] (type: singleValue) - the color of the card's symbols (red, green or blue)
		\item[filling] (type: singleValue) - the filling of the card's symbols (empty, half or full)
		\item[form] (type: singleValue) - the form of the card's symbols (ellipse, rectangle ot triangle)
		\item[number] (type: singleValue) - the number of the card's symbol (one, two or three)
	\end{itemize}
	\paragraph{class methods}
		\subparagraph{numberOfCardsNeededForSet (constants)} A card of this set does need two other cards for a set: Therefore return always: \texttt{3}.
		\subparagraph{isGameCardClass (constants)} we are a real GameCardClass therefore return \texttt{true}.
		\subparagraph{createSetWithAllCards (instance creation)} Create a set of all possible cards. Let's see: We have four properties and each has three possible values. That's a total of $3^4$=72 cards.
		\subparagraph{colors (private)} returns a Set with all possible ColorValues of the elements on the cards.
		\subparagraph{fillings (private)} returns a Set with all possible fillings (asString) of the elements on the cards.
		\subparagraph{forms (private)} returns a Set with all possible forms (asString) of the elements on the cards.
		\subparagraph{numbers (private)} returns a Set with all possible numbers of the elements on the cards.
		\subparagraph{color: aColor filling: aFilling form: aForm number: aNumber (private instance creation)} creates a card with the given properties.
	\paragraph{instance methods}
		\subparagraph{color} is a simple access method to the color slot.
		\subparagraph{filling} is a simple access method to the filling slot.
		\subparagraph{form} is a simple access method to the form slot.
		\subparagraph{number} is a simple access method to the number slot.
		\subparagraph{scoreForSet: aSet} returns the score for a Set. Each difference of a property counts as one point. You can find more information at the games help file.
		\subparagraph{defaultViewClass (default)} returns the \texttt{MemoSetSetCardView class}.
		\subparagraph{isASet: aList (testing)} We need to test for each property if it is the same or different at all three cards. Only if this is true for all four properties the cards are a set and we return \texttt{true}.
		\subparagraph{propertiesAreEqualOrAllDifferentTo: first and: second and: third (private testing)} is getting three properties and returns if they are alle the same or all different.

		\subsubsection{MemoSetMemoSetCard}
\index{MemoSetMemoSetCard}		
		inherits from: \texttt{MemoSetSetCard} and implements the "Memory Set" cards.
\index{MemoSetSetCard}		
	\paragraph{slots} This class owns only inherited slots.
	\paragraph{instance methods}
		\subparagraph{defaultViewClass (default)} returns the \texttt{MemoSetMemoSetCardView class}.	

	\subsection{relations}
		\subsubsection{to MemoSetGame and MemoSetUser}
		\includegraphics{MemoSetCardGameUser.eps}
\index{MemoSetCard}
\index{MemoSetGame}
\index{MemoSetUser}		
\section{MemoSetCardController}
\index{MemoSetCardController}
inherits from: CoastController
\index{CoastController}	
	
	\subsection{methods}	
		\subsubsection{instance}
		\paragraph{events}
			\subparagraph{redButonPressedEvent:} inform the model (a subclass of MemoSetCard) of the controller that it has been clicked on.
\index{MemoSetCard}

\section{MemoSetCardView}
\index{MemoSetCardView}
inherits from: \texttt{CoastView}
\index{CoastView}
	
	\subsection{methods}
		\subsubsection{class}
		\paragraph{constants}
			\subparagraph{borderSize} returns the size of the border used for awareness to show the user which other users are curently selecting the card.
			\subparagraph{cardBackground} returns the color of the cardBackground used if the card is shown but not selected by the user.
\index{MemoSetUser}			
			\subparagraph{cardSize} returns the size of the card.
			\subparagraph{size} returns the size of the card including the border at all four sides.
		\paragraph{resources}
			\subparagraph{unselectedCardImage} an image of the back of the card.

		\subsubsection{instance}
		\paragraph{accessing}
			\subparagraph{composeBounds} returns the proper bounds including the border.
			\subparagraph{defaultControllerClass} returns the \texttt{MemoSetCardController class}.
\index{MemoSetCardController}						
		\paragraph{displaying}
			\subparagraph{displayCardBackgroundOn: aGraphicsContext} displays the background of a card.
			\subparagraph{displayCardBorderOn: aGraphicsContext} displays the border of a card.
			\subparagraph{displaySelectionOn: aGraphicsContext} displays the selection of a card into the card's border.
			\subparagraph{displayUnselectedCardOn: aGraphicsContext} displays the back of a card.
	
	\subsection{subclasses}
	
		\subsubsection{overview}
			\includegraphics{MemoSetCardViewInherit.eps}
			
		\subsubsection{MemoSetEmptyCardView}
\index{MemoSetEmptyCardView}		
		inherits from: \texttt{CoastView}
\index{CoastView}
		\paragraph{instance methods}
			\subparagraph{displayOn: aGraphicsContext} do not display anything.
			
		\subsubsection{MemoSetSetCardView}
\index{MemoSetSetCardView}
		inherits from: \texttt{MemoSetCardView}
\index{MemoSetCardView}
		\paragraph{class methods}
			\subparagraph{objectSize (constants)} returns the proper object size of the elements (rectangle, ellipse, triangle).
			\subparagraph{padding (constants)} returns the proper disctance between the elements and the border of the card.
		\paragraph{instance methods}
			\subparagraph{composeDisplayOn: aGraphicsContext (displaying)} displays the card.
			\subparagraph{displayCardElementsOn: aGraphicsContext (displaying)} is the submethod which actually draws the elements by using the methods mentioned at the private protocoll.
			\subparagraph{ellipseAt: aPoint(private)} is used for drawing ellipsoids.
			\subparagraph{emptyPattern(private)} returns an empty pattern.
			\subparagraph{fullPattern(private)} returns a full pattern.
			\subparagraph{halfPattern(private)} returns a half filled pattern.
			\subparagraph{p1(private)} returns the point at which one object is displayed.
			\subparagraph{p2(private)} returns two points where two objects are displayed.
			\subparagraph{p3(private)} returns three points where three objects are displayed.
			\subparagraph{rectangleAt: aPoint(private)} is used for drawing rectangles.
			\subparagraph{triangleAt: aPoint(private)} is used for drawing triangles.
			
			\subsubsection{MemoSetMemoSetCardView}
\index{MemoSetMemoSetCardView}
		inherits from: \texttt{MemoSetSetCardView}
\index{MemoSetSetCardView}
		\paragraph{instance methods}
			\subparagraph{composeDisplayOn: aGraphicsContext (displaying)} displays the card by calling the super method if the card is selected or otherwise drawing the back of a card.
			
\section{MemoSetClient}
\index{MemoSetClient}
inherits from: \texttt{CoastApplicationClientWithUI}
\index{CoastApplicationClientWithUI}
	
	\subsection{methods}
		\subsubsection{instance}
		\paragraph{user management}
			\subparagraph{defaultUserClass} sets the defaultUserClass to MemoSetUser
\index{MemoSetUser}			

\section{MemoSetGame}
\index{MemoSetGame}
inherits from: \texttt{CoastModel} and represents the game. Here cards will be taken from the pile and placed on the table.
\index{CoastModel}
	\paragraph{slots:}
	\begin{itemize}
		\item[cards] (type: set) - the cards "on the pile".
		\item[components] (type: dictionary) - the cards "on the table".
	\end{itemize}		
	
	\subsection{methods}
		
		\subsubsection{class}
		\paragraph{instance creation}
			\subparagraph{newGame: aMemoSetCardSubclass} actually creates the game, gets all cards from the MemoSetCardSubclass and places some of them "on the table".
\index{MemoSetCard}			
		\subsubsection{instance}
		\paragraph{accessing}
			\subparagraph{cardsOnPile} returns the number of cards on the pile.
			\subparagraph{components} returns all cards which are currently on the table.
			\subparagraph{gameName} returns the gameName.
		\paragraph{action}
			\subparagraph{collectCardsForUser: aUser} collects a set from the table an gives it to the user.
\index{MemoSetUser}
			\subparagraph{getNewCard} takes a card from the pile. If the pile is empty it creates a emptyCard.
\index{MemoSetCard}

\section{MemoSetGameView}
\index{MemoSetGameView}
inherits from: \texttt{CoastCompositeView}
\index{CoastCompositeView}
	
	\subsection{methods}
	
		\subsubsection{instance}
		
		\paragraph{composing}
			\subparagraph{composeComponents} takes all cards on the table and translates their position from the dictionary to coordinates.
\index{MemoSetCard}

\section{MemoSetLauncher}
\index{MemoSetLauncher}
inherits from: \texttt{UI.ApplicationModel}
\index{ApplicationModel}
	\paragraph{instance variables}
	\begin{itemize}
		\item[server] - a valueholder for the server inputfield
		\item[username] - a valueholder for the username inputfield
		\item[usercolor] - the actual color of the user
	\end{itemize}

	\subsection{methods}
		
		\subsubsection{class}
		\paragraph{accessing}
			\subparagraph{localServerIsRunning} returns a Boolean if the Coast Mediator is started.
		\paragraph{interface specs}
			\subparagraph{windowSpecs} specifies the userinterface for the launcher.
		\paragraph{interface opening}
			\subparagraph{open} opens a new launcher instance.
		\paragraph{resources}
			\subparagraph{mediatorLabel} returns the string for the 'Start/Stop server' Button depending on localServerIsRunning.
			\subparagraph{memoSetLogo} contains the background logo for the launcher
			\subparagraph{menu} calls MemoSetMenu
\index{MemoSetMenu}
			\subparagraph{windowIcon} contains the windowIcon			
			\subparagraph{windowIconMask} contains the corresponding mask for the windowIcon			
		
		\subsubsection{instance}

	\paragraph{accessing}
		\subparagraph{appClient} starts COAST, provides the MemoSetClient with the correct host and returns it
		\subparagraph{host} returns an proved value of servername
		\subparagraph{inverseColor: aColorValue} returns a the inverse color for aColorValue
		\subparagraph{randomColor} returns a randomly selected ColorValue
	\paragraph{actions}
	all methods are called if the corresponding button or menuitem is activated.
		\subparagraph{help} opens the help file
		\subparagraph{joinGame} opens a SelectionDialog with the existing volumes and calls startGame: with the selected volume.
		\subparagraph{mediator} starts or stops the CoastMediator depending on the state of it.
		\subparagraph{newGame} opens a Dialog, asks for a new game name and then calls startGame:
		\subparagraph{playerColor} opens a ColorSelectionDialog and sets the color at the special volume '\#users', changes the color of the colorbutton, too.
		\subparagraph{stopGame}	exits the current volume
		\subparagraph{visitAragon} opens a browser with the aragon website by calling the method at \texttt{MemoSetMenu class}
\index{MemoSetMenu}
		\subparagraph{visitCoast} opens a browser with the Coast website by calling the method at \texttt{MemoSetMenu class}
		\subparagraph{visitMemoSet} opens a browser with the MemoSet website by calling the method at \texttt{MemoSetMenu class}
	\paragraph{aspects}
		\subparagraph{server} a simple access to the valueholder for server
		\subparagraph{username} a simple access to the valueholder for username
	\paragraph{dialogs}
		\subparagraph{dialogAboutMemoSet} shows a short dialog about MemoSet.
		\subparagraph{dialogChooseGameType} ask which type of cards (subclasses of \texttt{MemoSetCard}) shoud be used
\index{MemoSetCard}		
		\subparagraph{dialogChooseNewVolume} choose a new volume
		\subparagraph{dialogChooseVolumeFrom: volumes} choose a volume from the given list
		\subparagraph{dialogNewPassForUser: aUsername} ask for new password
		\subparagraph{dialogPassNoMatch} show a warning that the passwords don't match.
		\subparagraph{dialogRevalidatePassForUser: aUsername} let the user reenter his new password
		\subparagraph{dialogValidatePassForUser: aUsername} ask for the user's password
		\subparagraph{dialogWrongPass} tell the user his password was wrong
	\paragraph{events}
		\subparagraph{noticeOfWindowClose: t1} stops the MemoSetClient and the CoastMediator if the MemoSetLauncher window is closed.
		\subparagraph{serverChanged} whenever the server is changed, the username InputField should be cleared.
		\subparagraph{usernameChanged} if the username changes we have to update the usercolor. We read it at the special volume '\#users'.
		\subparagraph{validateUsername: anInputBox} we have to validate the user here. There are two possibilities:
		\begin{itemize}
			\item[the user already exists] - then we have to check his password and accept or decline the change
			\item[the user does not exist] - then we first have to ask him for a password, check if he remembers and did no typo and then create a new user.
		\end{itemize}
	\paragraph{utility}
		\subparagraph{setColorButtonColor: aColorValue} changes the color of the colorbutton to aColorValue
		\subparagraph{startCoast} starts the MemoSetClient if he is not already running
		\subparagraph{startGame: aName} enters the specified game
		\subparagraph{startGame: aName ofType: aMemoSetCardSubclass} creates the game with the specified type of cards (subclasses of \texttt{MemoSetCard})
\index{MemoSetCard}
		\subparagraph{startMediator} starts the COAST mediator
		\subparagraph{stopMediator} stops the COAST mediator

\section{MemoSetLocalApplicationModel}
\index{MemoSetLocalApplicationModel}
inherits from: \texttt{CoastLocalApplicationModel}
\index{CoastLocalApplicationModel}
	\paragraph{slots:}
	\begin{itemize}
		\item[gameView] - is computed by computeGameView
		\item[players] - is computed by computePlayers
		\item[userView] - is computed by computeUserView
\index{MemoSetGame}
	\end{itemize}
	\subsection{methods}
		
		\subsubsection{class}
		
		\paragraph{accessing}
			\subparagraph{sharedApplicationModelClass} returns the shared application model class MemoSetApplicationModel
\index{MemoSetApplicationModel}			
		\paragraph{interface specs}
			\subparagraph{windowSpecs} specifies the userinterface for the launcher.
		\paragraph{resources}
			\subparagraph{menu} calls MemoSetMenu
\index{MemoSetMenu}
			\subparagraph{windowIcon} contains the windowIcon	
		\subsubsection{instance}
		
		\paragraph{actions}
			\subparagraph{collectCards} starts the "let's see if a set is selected and collect it"-action.
			\subparagraph{help} opens the help file
			\subparagraph{visitAragon} opens a browser with the aragon website by calling the method at \texttt{MemoSetMenu class}
\index{MemoSetMenu}
			\subparagraph{visitCoast} opens a browser with the Coast website by calling the method at \texttt{MemoSetMenu class}
			\subparagraph{visitMemoSet} opens a browser with the MemoSet website by calling the method at \texttt{MemoSetMenu class}
		\paragraph{aspects}
			\subparagraph{cardsOnPile} a simple access to the valueholder for the number of cards left on the pile
			\subparagraph{gameName} a simple access to the valueholder for the gameName
			\subparagraph{playersAspect} a simple access to the SelectionInList with the players
			\subparagraph{scoreAspect} a simple access to the valueholder for the player's score
			\subparagraph{setNumberAspect} a simple access to the valueholder for the user's number of sets
\index{MemoSetUser}
		\paragraph{composing}
			\subparagraph{computeGameView} is the computation method for the corresponding slot.
			\subparagraph{computePlayers} is the computation method for the corresponding slot.
			\subparagraph{computeUserView} is the computation method for the corresponding slot.
			
		\paragraph{events}
			\subparagraph{noticeOfWindowClose: t1} if the window is closed shutdown the MemoSetClient
\index{MemoSetClient}			
		\paragraph{view}
			\subparagraph{gameView} is a simple access to the gameView slot
			\subparagraph{userView} is a simple access to the userView slot

\section{MemoSetMenu}
\index{MemoSetMenu}
inherits from: \texttt{Object}
\index{Object}
	implements a short menu which is used from the MemoSetLauncher and the MemoSetLocalApplicationModel.
\index{MemoSetLauncher}
\index{MemoSetLocalApplicationModel}

	\subsection{methods}
	
		\subsubsection{class}
		\paragraph{resources}
			\subparagraph{menu} is the menu itself.
		\paragraph{utility}
			\subparagraph{help} opens the help file for MemoSet by using a Win32Process.
			\subparagraph{openBrowserAt: urlStringInput} opens the default Application for urls with the given url by using a Win32Process.

\section{MemoSetUser}
\index{MemoSetUser}
inherits from: \texttt{CoastUser}
\index{CoastUser}
	\paragraph{slots:}
	\begin{itemize}
		\item[collectedCards] (type: orderedCollection) - the cards the user has collected.
		\item[color] (type: singleValue) - the user's color.
		\item[password] (type: singleValue) - the user's password.
		\item[score] (type: singleValue) - the user's score.
		\item[selectedCards] (type: singleValue) - the cards the user has selected.
		\item[sets] (type: singleValue) - the number of user's sets.
\index{MemoSetCard}		
	\end{itemize}

	\subsection{methods}
	
		\subsubsection{instance}
		
		\paragraph{accessing}
			\subparagraph{collectCards: aCollection} take the cards and change the values for sets and score.
			\subparagraph{collectedCards} is an access method to the cards the user has already collected.
			\subparagraph{color} is an access method to the user's color.
			\subparagraph{color: aColorValue} is an access method to the user's color.
			\subparagraph{lastSet} assuming the user has laid his cards on his pile the method returns the last set.
			\subparagraph{password} is an access method to the user's password.
			\subparagraph{password: aString} is an access method to the user's password.
			\subparagraph{score} is an access method to the user's score.
			\subparagraph{selectedCards} returns the cards the user has selected.
			\subparagraph{sets} is an access method to the user's number of sets.
		\paragraph{comparing}
			\subparagraph{<=} makes it possible to sort user.
		\paragraph{printing}
			\subparagraph{printString} overwriting this method makes it much nicer. Now there is displayed the user's name, his score and the number of sets he already has.
			
\section{MemoSetUserView}
\index{MemoSetUserView}
inherits from: \texttt{CoastUserView}
\index{CoastUserView}

	\subsection{methods}	
	
		\subsubsection{instance}
		\paragraph{composing}
			\subparagraph{composeComponents} takes the last three cards the user collected and calculates their positions.

\printindex
\end{document}