diff options
Diffstat (limited to 'src/docs')
-rw-r--r-- | src/docs/class.puml | 153 |
1 files changed, 64 insertions, 89 deletions
diff --git a/src/docs/class.puml b/src/docs/class.puml index dbfb731..151e334 100644 --- a/src/docs/class.puml +++ b/src/docs/class.puml | |||
@@ -1,6 +1,8 @@ | |||
1 | @startuml | 1 | @startuml |
2 | 2 | ||
3 | skinparam linetype ortho | 3 | skinparam linetype ortho |
4 | skinparam monochrome reverse | ||
5 | skinparam backgroundColor #FFFFFF | ||
4 | 6 | ||
5 | class Main{ | 7 | class Main{ |
6 | static void main(String[]) | 8 | static void main(String[]) |
@@ -23,43 +25,48 @@ package viewer { | |||
23 | } | 25 | } |
24 | 26 | ||
25 | package context { | 27 | package context { |
28 | interface Updateable { | ||
29 | List<Event> update(Context) | ||
30 | static List<Event> updateAll(List<Updateable>, Context) | ||
31 | } | ||
32 | |||
26 | class Context { | 33 | class Context { |
27 | Context(Game,List<Event>,GraphicsContext) | 34 | Context(Game, List<Event>, GraphicsContext) |
28 | final Game | ||
29 | final List<Event> | ||
30 | final GraphicsContext | ||
31 | Game getGame() | 35 | Game getGame() |
32 | List<Event> getEvents() | 36 | List<Event> getEvents() |
33 | GraphicsContext getGraphicsContext() | 37 | GraphicsContext getGraphicsContext() |
38 | Duration getTimeDelta() | ||
34 | } | 39 | } |
35 | 40 | ||
36 | class GraphicsContext { | 41 | class GraphicsContext { |
37 | final Graphics2D | 42 | Graphics2D, ScreenInfo |
38 | final ScreenInfo | 43 | |
39 | paintCircle(Color, Vec2, float) | 44 | paintCircle(Color, Vec2, float) |
40 | paintSquare(Color, Vec2, float, float) | 45 | paintSquare(Color, Vec2, float, float) |
41 | paintString(Color, Vec2,String) | 46 | paintString(Color, Vec2,String) |
42 | } | 47 | } |
43 | 48 | ||
44 | class InputHandler { | 49 | class InputHandler { |
45 | private final ApplicationContext | 50 | ApplicationContext |
51 | |||
46 | InputHandler(ApplicationContext) | 52 | InputHandler(ApplicationContext) |
47 | List<Event> getEvents() | 53 | List<Event> getEvents() |
48 | } | 54 | } |
49 | 55 | ||
50 | class ScreenManager { | 56 | class ScreenManager { |
51 | private final ApplicationContext | 57 | ApplicationContext, Graphics2D |
52 | private final Graphics2D | 58 | |
53 | ScreenManager(ApplicationContext,Graphics2D) | 59 | ScreenManager(ApplicationContext,Graphics2D) |
54 | GraphicsContext clearScreen() | 60 | GraphicsContext clearScreen() |
55 | } | 61 | } |
56 | 62 | ||
57 | class Game { | 63 | class Game implements Updateable { |
58 | Stage | 64 | Stage |
59 | final List<Controller> | 65 | final List<Controller> |
60 | int indexBoard | 66 | int indexBoard |
61 | final List<Board> | 67 | final List<Board> |
62 | bool over | 68 | bool over |
69 | |||
63 | Game(List<Board>) | 70 | Game(List<Board>) |
64 | Stage getStage() | 71 | Stage getStage() |
65 | bool isOver() | 72 | bool isOver() |
@@ -68,31 +75,36 @@ package context { | |||
68 | void retryStage() | 75 | void retryStage() |
69 | List<Event> update(Context context) | 76 | List<Event> update(Context context) |
70 | } | 77 | } |
78 | |||
79 | class Stage implements Updateable { | ||
80 | Stage(Board) | ||
81 | Board getBoard() | ||
82 | List<Block> getBlocks() | ||
83 | List<Event> update(Context) | ||
84 | bool isCleared() | ||
85 | } | ||
71 | } | 86 | } |
72 | 87 | ||
73 | package event { | 88 | package event { |
74 | interface Event | 89 | interface Event |
75 | |||
76 | interface InputEvent implements Event | ||
77 | interface GameEvent implements Event | 90 | interface GameEvent implements Event |
91 | interface InputEvent implements Event | ||
78 | 92 | ||
79 | class DropBombEvent implements InputEvent | 93 | class ConfirmOrder implements InputEvent |
94 | class BombSetupOrder implements InputEvent | ||
80 | 95 | ||
81 | class AddBombEvent implements InputEvent { | 96 | class MoveRobotOrder implements InputEvent { |
82 | final TileVec2 | 97 | MoveRobotEvent(TileVec2) |
83 | AddBombEvent(TileVec2) | 98 | TileVec2 getTarget() |
84 | TileVec2 getTile() | ||
85 | } | 99 | } |
86 | 100 | ||
87 | class MoveRobotEvent implements InputEvent { | 101 | class BombSetupEvent implements GameEvent { |
88 | final TileVec2 | 102 | final TileVec2 |
89 | MoveRobotEvent(TileVec2) | 103 | AddBombEvent(TileVec2) |
90 | TileVec2 getTile() | 104 | TileVec2 getTile() |
91 | } | 105 | } |
92 | 106 | ||
93 | class ConfirmEvent implements InputEvent | 107 | class GameOverEvent implements GameEvent |
94 | class GameOverEvent implements Event | ||
95 | |||
96 | 108 | ||
97 | class ExplosionEvent implements GameEvent { | 109 | class ExplosionEvent implements GameEvent { |
98 | Block source | 110 | Block source |
@@ -114,7 +126,6 @@ package board { | |||
114 | 126 | ||
115 | class BoardValidator { | 127 | class BoardValidator { |
116 | static class Constraint | 128 | static class Constraint |
117 | Board | ||
118 | 129 | ||
119 | BoardValidator(Board) | 130 | BoardValidator(Board) |
120 | BoardValidator validate(Predicate<Board>, String error) | 131 | BoardValidator validate(Predicate<Board>, String error) |
@@ -130,15 +141,12 @@ package board { | |||
130 | static final int TILE_DIM | 141 | static final int TILE_DIM |
131 | static TileVec2 fromVec2(Vec2) | 142 | static TileVec2 fromVec2(Vec2) |
132 | 143 | ||
133 | Vec2 | ||
134 | TileVec2(col, row) | 144 | TileVec2(col, row) |
135 | Vec2 toPixelPos() | 145 | Vec2 toPixelPos() |
136 | List<TileVec2> neighbors() | 146 | List<TileVec2> neighbors() |
137 | } | 147 | } |
138 | 148 | ||
139 | class PathFinder { | 149 | class PathFinder { |
140 | Graph | ||
141 | |||
142 | PathFinder(Board) | 150 | PathFinder(Board) |
143 | List<TileVec2> findPath(TileVec2 origin, TileVec2 target) | 151 | List<TileVec2> findPath(TileVec2 origin, TileVec2 target) |
144 | } | 152 | } |
@@ -146,12 +154,8 @@ package board { | |||
146 | 154 | ||
147 | package block { | 155 | package block { |
148 | enum BlockType { | 156 | enum BlockType { |
149 | FREE | 157 | FREE, WALL, TRASH, |
150 | WALL | 158 | GARBAGE, ROBOT, BOMB |
151 | TRASH | ||
152 | GARBAGE | ||
153 | ROBOT | ||
154 | BOMB | ||
155 | 159 | ||
156 | boolean isBounding() | 160 | boolean isBounding() |
157 | boolean mustBeReachable() | 161 | boolean mustBeReachable() |
@@ -163,78 +167,49 @@ package block { | |||
163 | Block build(BlockType, TileVec2) | 167 | Block build(BlockType, TileVec2) |
164 | } | 168 | } |
165 | 169 | ||
166 | abstract class Block { | 170 | abstract class Block implements Updateable { |
167 | BlockType | 171 | Block(BlockType) |
168 | List<Controller> | 172 | BlockType getType() |
169 | Vec2 | ||
170 | |||
171 | Block(BlockType, List<Controller>, Vec2) | ||
172 | void setPos(Vec2) | ||
173 | BlockType getBlockType() | ||
174 | Vec2 getPos() | ||
175 | TileVec2 getTile() | 173 | TileVec2 getTile() |
176 | List<Event> update(Context) | 174 | abstract Vec2 getPos() |
175 | abstract void link(World) | ||
177 | } | 176 | } |
178 | 177 | ||
179 | class WallBlock extends Block | 178 | abstract class JBoxBlock extends Block { |
180 | class TrashBlock extends Block | 179 | JBoxBlock(BlockType, BodyType, Shape, Vec2) |
181 | class BombBlock extends Block | 180 | Vec2 getPos() |
182 | class GarbageBlock extends Block | 181 | void link(World) |
183 | class RobotBlock extends Block | ||
184 | |||
185 | class Stage { | ||
186 | List<Block> | ||
187 | Board | ||
188 | Stage(Board) | ||
189 | List<Block> getBlocks() | ||
190 | List<Event> update(Context) | ||
191 | bool isCleared() | ||
192 | } | 182 | } |
193 | } | 183 | |
194 | 184 | class RobotBlock extends Block { | |
195 | package controller { | 185 | Vec2 getPos() |
196 | interface Controller { | 186 | void link(World world) |
197 | List<Event> update(Context) | 187 | List<Event> update(Context context) |
198 | } | 188 | } |
199 | 189 | ||
200 | abstract class BlockController implements Controller { | 190 | class WallBlock extends JBoxBlock { |
201 | Block | 191 | List<Event> update(Context context) |
202 | Controller(Block) | ||
203 | } | 192 | } |
204 | 193 | ||
205 | class BlockControllerFactory { | 194 | class TrashBlock extends JBoxBlock { |
206 | BlockController build(Block) | 195 | List<Event> update(Context context) |
207 | } | 196 | } |
208 | class GameController implements Controller | ||
209 | |||
210 | abstract class PhysicsController extends BlockController | ||
211 | abstract class DisplayController extends BlockController | ||
212 | |||
213 | class WallPhysicsController extends PhysicsController | ||
214 | class WallDisplayController extends DisplayController | ||
215 | |||
216 | class TrashPhysicsController extends PhysicsController | ||
217 | class TrashDisplayController extends DisplayController | ||
218 | |||
219 | class GarbagePhysicsController extends PhysicsController | ||
220 | class GarbageDisplayController extends DisplayController | ||
221 | 197 | ||