30.06.2013 Aufrufe

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

10.2 Das DDD 287<br />

93 ∗ handler i s then s e t when the gameboard i t s e l f i s r e g i s t e r e d<br />

94 ∗ with the ” master ” output handler .<br />

95 ∗ The number of rows and the number o f columns are checked <strong>in</strong><br />

96 ∗ a way that they both have to be non−zero and that the number<br />

97 ∗ o f f i e l d s o v e r a l l i s even ( there i s always an even number o f<br />

98 ∗ cards ! ) . I f someth<strong>in</strong>g i s wrong the values have to be c o r r e c t e d<br />

99 ∗ accord<strong>in</strong>gly ( j u s t because exceptions are not known yet ) .<br />

100 ∗ @param num rows The number of rows f o r the f i e l d<br />

101 ∗ @param num cols The number of columns f o r the f i e l d<br />

102 ∗/<br />

103 MemoryGameboard( u<strong>in</strong>t32 num rows , u<strong>in</strong>t32 num cols ) ;<br />

104<br />

105 /∗ Destructor<br />

106 ∗ Has to d e l e t e a l l v e c t o r s and the output handler f o r the<br />

107 ∗ conta<strong>in</strong>er .<br />

108 ∗/<br />

109 virtual ˜MemoryGameboard ( ) ;<br />

110<br />

111 /∗ Because the gameboard does not produce any s p e c i a l i z e d<br />

112 ∗ output i t s e l f ( a l l text f i e l d s are r e g i s t e r e d as text<br />

113 ∗ d i s p l a y a b l e s ) i t only t r i g g e r s output o f the conta<strong>in</strong>ed<br />

114 ∗ d i s p l a y a b l e elements .<br />

115 ∗ @param context The output context to write to<br />

116 ∗/<br />

117 virtual void writeDisplayRep ( OutputContext &context )<br />

118 {<br />

119 i f ( conta<strong>in</strong>er output handl<strong>in</strong>g )<br />

120 conta<strong>in</strong>er output handl<strong>in</strong>g −>writeOutput ( ) ;<br />

121 }<br />

122<br />

123 /∗ When t h i s method i s c a l l e d a l l necessary text d i s p l a y a b l e s<br />

124 ∗ have to be generated and stored <strong>in</strong> the row and column head<strong>in</strong>g<br />

125 ∗ v e c t o r s . Additionally the conta<strong>in</strong>er output handler has to<br />

126 ∗ be i n s t a n t i a t e d and these generated d i s p l a y a b l e s have to<br />

127 ∗ be r e g i s t e r e d there together with a l l the cards .<br />

128 ∗ ATTENTION: This behaviour means that a l l cards already<br />

129 ∗ have to be on the gameboard before r e g i s t e r i n g i t with the<br />

130 ∗ d i s p l a y handler ! ! ! ! Otherwise t h i s method ’ s tasks are not<br />

131 ∗ f u l f i l l a b l e c o r r e c t l y ! ! !<br />

132 ∗ ATTENTION: I f t h i s board i s r e g i s t e r e d with more than one<br />

133 ∗ d i s p l a y handler the i n i t i a l i z i n g s t e p s must not be done<br />

134 ∗ aga<strong>in</strong> , because everyth<strong>in</strong>g i s already setup c o r r e c t l y .<br />

135 ∗ Therefore t h i s method has to check t h i s b e f o r e .<br />

136 ∗ @param handler The handler f o r which t h i s d i s p l a y a b l e was<br />

137 ∗ r e g i s t e r e d .<br />

138 ∗/<br />

139 virtual void d i s p l a y a b l e R e g i s t e r e d (<br />

140 SimpleOutputHandl<strong>in</strong>g &handler ) ;<br />

141<br />

142 /∗ Turns a l l the cards so that they show the f r o n t s i d e . This<br />

143 ∗ method does not t r i g g e r any output , so f o r the r e s u l t o f<br />

144 ∗ the operation to be shown the output has to be t r i g g e r e d<br />

145 ∗ e x p l i c i t l y by an accord<strong>in</strong>g c a l l to the d i s p l a y handler .<br />

146 ∗ This method a l s o updates the i n t e r n a l cache f o r the number<br />

147 ∗ o f cards that show t h e i r f r o n t s i d e at the moment ( t h i s<br />

148 ∗ i s the v a r i a b l e num cards front side up ) .<br />

149 ∗/<br />

150 virtual void putAllCardsFrontSideUp ( ) ;<br />

151<br />

152 /∗ Turns a l l the cards so that they show the back s i d e . This<br />

153 ∗ method does not t r i g g e r any output , so f o r the r e s u l t o f<br />

154 ∗ the operation to be shown the output has to be t r i g g e r e d<br />

155 ∗ e x p l i c i t l y by an accord<strong>in</strong>g c a l l to the d i s p l a y handler .<br />

156 ∗ This method a l s o updates the i n t e r n a l cache f o r the number<br />

157 ∗ o f cards that show t h e i r f r o n t s i d e at the moment ( t h i s<br />

158 ∗ i s the v a r i a b l e num cards front side up ) .

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!