ジャンケンアプリケーション課題の各クラスの主要部説明
UMLのクラス図で、コーディングに直接結びつくような設計段階の詳細クラス図には、属性や操作において下記のように型の明示をすることができる。
属性名 : 型
操作名 ( パラメータのコンマ区切りのリスト ) : 戻り値の型
パラメータのリストの中の一つ一つのパラメータも、
パラメータ名 : 型
のように型の明示をすることができる。
以下の要点まとめにおいても、UMLの記法に従った型の指定方法を使用している。
- クラス Player (抽象クラス。UMLでは斜体にする)
-
操作:
- number() : int
- type() : String (抽象メソッド。UMLでは斜体にする)
- result(r : Result, moves : int[]) : void (抽象メソッド。UMLでは斜体にする)
- next()
- select() : int (抽象メソッド。UMLでは斜体にする)
- クラス RandomPlayer
-
Player を継承
操作:
- type() : String
- result(r : Result, moves : int[]) : void
- select() : int
- クラス LatestWinPlayer
-
Player を継承
操作:
- type() : String
- result(r : Result, moves : int[]) : void
- select() : int
- クラス LatestLossPlayer
-
Player を継承
操作:
- type() : String
- result(r : Result, moves : int[]) : void
- select() : int
- クラス RepeatPlayer
-
Player を継承
操作:
- type() : String
- result(r : Result, moves : int[]) : void
- select() : int
- クラス Game
-
属性:
関連:
- players (単方向) → クラス Player (多重度 1 対 2..* )
操作:
- play(moves : int[], results : Result[]) : void
- match(numGames : int, showDetail : boolean) : void