This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class State(): | |
| """Stateパターンの抽象クラス | |
| """ | |
| def action(self): | |
| """動作メソッド | |
| Returns: | |
| None | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @startuml | |
| skinparam ClassAttributeIconSize 0 | |
| hide circle | |
| hide empty member | |
| main -> "<u>context</u>\n<u>:Context</u>" : <<create>> | |
| "<u>context</u>\n<u>:Context</u>" -> "<u>the_beginning_of_the_day</u>\n<u>:TheBeginningOfTheDay</u>" : <<create>> | |
| "<u>context</u>\n<u>:Context</u>" -> "<u>the_end_of_the_day</u>\n<u>:TheEndOfTheDay</u>" : <<create>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @startuml | |
| skinparam ClassAttributeIconSize 0 | |
| hide circle | |
| hide empty member | |
| main -> "<u>context</u>\n<u>:Context</u>" : <<create>> | |
| "<u>context</u>\n<u>:Context</u>" -> "<u>the_beginning_of_the_day</u>\n<u>:TheBeginningOfTheDay</u>" : <<create>> | |
| "<u>context</u>\n<u>:Context</u>" -> "<u>the_end_of_the_day</u>\n<u>:TheEndOfTheDay</u>" : <<create>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| from src.state import Context | |
| class StateTest(unittest.TestCase): | |
| def setUp(self): | |
| self.context = Context() | |
| def test_initial_state(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main(): | |
| print("<<一日の始まり>>") | |
| context = Context() | |
| context.action() | |
| context.greeting() | |
| print("===") | |
| print("<<一日の終わり>>") | |
| context.change_state("一日の終わり") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @startuml | |
| skinparam ClassAttributeIconSize 0 | |
| hide circle | |
| hide empty member | |
| class Context { | |
| state | |
| change_state() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @startuml | |
| left to right direction | |
| skinparam packageStyle rect | |
| actor 自分 | |
| rectangle ロボット { | |
| 自分 -- (利用) | |
| } | |
| @enduml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Zero | |
| One | |
| The End of Main Function... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ReturnC_003_UserFunction.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 | |
| // | |
| #include "stdafx.h" | |
| /* プロトタイプ宣言 */ | |
| int function_add_one(int num); | |
| int _tmain(int argc, _TCHAR* argv[]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ReternC_002_Variable.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 | |
| // | |
| #include "stdafx.h" | |
| int _tmain(int argc, _TCHAR* argv[]) | |
| { | |
| /* 変数 */ | |
| int num; |
NewerOlder