: Message from : Message to : Message from : Message to Return from Return to : Message from : Message to : Message from : Message to Return from Return to : Message from : Message to Return from Return to : Message from : Message to Return from Return to : Message from : Message to : Message from : Message to Return from Return to : Message from : Message to Return from Return to : Message from : Message to : Message from : Message to : Message from : Message to Return from Return to : Return : Return : Return : Return : Return position: Return : Return : Call move: Call checkHits: Call increaseScore: Call playHitSound: Call check position: Call decrementBalls: Call displayPlayersScore: Call calculateNewDirection: Call calculateNewDirection: Call playHitSound: Call displayGameOverText: Call Outside actor :Brick: Lifeline object :Ball: Lifeline object :Paddle: Lifeline object :BallGame: Lifeline object :MovingObject: Lifeline object

Graph documentation: Ball Game behaviour - Design

Model nameBall Game behaviour - Design 
Statusdraft 
AuthorsDavid Hill 
DocumentationThis model describes interactions among the Ball game objects during the game. 
ObjectType of objectDocumentation
:Ball 
Lifeline object   
:BallGame 
Lifeline object   
:Brick 
Lifeline object   
:MovingObject 
Lifeline object   
:Paddle 
Lifeline object   
Outside actor 
Outside actor   

:Ball: Lifeline object

Object name 
ClassBall 
Stop?
Documentation 
In roleIn relationshipWith object(s)In role
: Message to  calculateNewDirection: Call  :MovingObject : Message from  
: Message to  calculateNewDirection: Call  :Paddle : Message from  
: Message to  check position: Call  :MovingObject : Message from  
: Return from : Return  :MovingObject : Return to  
: Return from position: Return  :MovingObject : Return to  
: Return from : Return  :MovingObject : Return to  
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

:BallGame: Lifeline object

Object name 
ClassBallGame 
Stop?
Documentation 
In roleIn relationshipWith object(s)In role
: Message from  displayPlayersScore: Call  :BallGame : Message to  
: Message from  displayGameOverText: Call  :BallGame : Message to  
: Message from  move: Call  :MovingObject : Message to  
: Message from  checkHits: Call  :MovingObject : Message to  
: Message to  displayPlayersScore: Call  :BallGame : Message from  
: Message to  displayGameOverText: Call  :BallGame : Message from  
: Message to  decrementBalls: Call  :MovingObject : Message from  
: Message to  : Call  Outside actor : Message from  
: Return from : Return  Outside actor : Return to  
: Return to : Return  :MovingObject : Return from  
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

:Brick: Lifeline object

Object name 
ClassBrick 
Stop?
Documentation 
In roleIn relationshipWith object(s)In role
: Message to  increaseScore: Call  :MovingObject : Message from  
: Message to  playHitSound: Call  :MovingObject : Message from  
: Return from : Return  :MovingObject : Return to  
: Return from : Return  :MovingObject : Return to  
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

:MovingObject: Lifeline object

Object name 
ClassMovingObject 
Stop?
Documentation 
In roleIn relationshipWith object(s)In role
: Message from  check position: Call  :Ball : Message to  
: Message from  decrementBalls: Call  :BallGame : Message to  
: Message from  playHitSound: Call  :Brick : Message to  
: Message from  playHitSound: Call  :Paddle : Message to  
: Message from  increaseScore: Call  :Brick : Message to  
: Message from  calculateNewDirection: Call  :Ball : Message to  
: Message to  move: Call  :BallGame : Message from  
: Message to  checkHits: Call  :BallGame : Message from  
: Return from : Return  :BallGame : Return to  
: Return to : Return  :Brick : Return from  
: Return to : Return  :Ball : Return from  
: Return to position: Return  :Ball : Return from  
: Return to : Return  :Ball : Return from  
: Return to : Return  :Brick : Return from  
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

:Paddle: Lifeline object

Object name 
ClassPaddle 
Stop?
Documentation 
In roleIn relationshipWith object(s)In role
: Message from  calculateNewDirection: Call  :Ball : Message to  
: Message to  playHitSound: Call  :MovingObject : Message from  
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

: Outside actor

none
In roleIn relationshipWith object(s)In role
: Message from  : Call  :BallGame : Message to  
: Return to : Return  :BallGame : Return from  
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

David Hill: Person

NameDavid Hill 
E-mailmailto:info@metacase.com 
Contact addressPark Court
Upper Essex Street
City 5
B8 6QB 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

Ball: Class [UML]

Class nameBall 
Attributes 
Operations+display()void, +calculateNewDirection(hitObject:MovingObject)void, +check position()void 
PackageGame 
Abstract?
Active?
Stereotype 
Overridability 
Role 
Parameters 
Constraints 
Invariant 
Derivation rules 
Responsibility 
DocumentationBall is the basic element of the game. Player tries to remove bricks by hitting them with the ball. 
Simple symbol?
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+display()void: Operation [UML]

Operation namedisplay 
Parameters 
Return type 
Overridability 
Stereotype 
Visibilitypublic 
Operation typeinstance 
Query?
Preconditions 
Postconditions 
Body 
DocumentationOverriden from superclass to display a round ball rather than a square 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+calculateNewDirection(hitObject:MovingObject)void: Operation [UML]

Operation namecalculateNewDirection 
Parametersin hitObject:MovingObject 
Return type 
Overridability 
Stereotype 
Visibilitypublic 
Operation typeinstance 
Query?
Preconditions 
Postconditions 
Body 
Documentation 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

in hitObject:MovingObject: Parameter

ParameterhitObject 
Data typeMovingObject 
Directionin 
Default value 
Effect 
Exception?
Stream?
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+check position()void: Operation [UML]

Operation namecheck position 
Parameters 
Return type 
Overridability 
Stereotype 
Visibilitypublic 
Operation typeinstance 
Query?
Preconditions 
Postconditions 
Body 
DocumentationReturns the location of the ball. 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

Game: Package

Package nameGame 
StereotypemodelLibrary 
DocumentationBall game packace include all the components of the ball game application. Because the application is small not other packages are used for categorization. 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

BallGame: Class [UML]

Class nameBallGame 
Attributes 
Operations 
Package 
Abstract?
Active?
Stereotype 
Overridability 
Role 
Parameters 
Constraints 
Invariant 
Derivation rules 
Responsibility 
Documentation 
Simple symbol?
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

Brick: Class [UML]

Class nameBrick 
Attributes+value:int =1 
Operations+playHitSound()void, +increaseScore()void 
PackageGame 
Abstract?
Active?
Stereotype 
Overridability 
Role 
Parameters 
Constraints 
Invariant 
Derivation rules 
Responsibility 
DocumentationSingle element of the wall. These will disappear, when the ball hits them. 
Simple symbol?
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+value:int =1: Attribute [UML]

Namevalue 
Data typeint 
Default value
Multiplicity 
Ordered?
Unique?
Sequence?
Stereotype 
Visibilitypublic 
Scopeinstance 
Access 
Derived?
Constraints 
DocumentationValue of the brick. When ball hits the brick, value will be added to player's currentScore. 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+playHitSound()void: Operation [UML]

Operation nameplayHitSound 
Parameters 
Return type 
Overridability 
Stereotype 
Visibilitypublic 
Operation typeinstance 
Query?
Preconditions 
Postconditions 
Body 
DocumentationWhen the ball hits a brick or a paddle, it makes a sound. 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+increaseScore()void: Operation [UML]

Operation nameincreaseScore 
Parameters 
Return type 
Overridability 
Stereotype 
Visibilitypublic 
Operation typeinstance 
Query?
Preconditions 
Postconditions 
Body 
DocumentationWhen then ball hits a brick it will disappear and the value of the brick will be added to player's currentScores. 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

MovingObject: Class [UML]

Class nameMovingObject 
Attributes+position:Point =100.0@100.0, -velocity:Point =0.0@2.0, +extent:Point, -colour:ColorValue 
Operations+display()void, +move(position:Point, direction:int)void, +checkHits()void 
PackageGame 
Abstract?
Active?
Stereotype 
Overridability 
Rolemodel 
Parameters 
Constraints 
Invariant 
Derivation rules 
Responsibility 
DocumentationMovingObject is an abstract class for all moving components of the ball game. 
Simple symbol?
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+position:Point =100.0@100.0: Attribute [UML]

Nameposition 
Data typePoint 
Default value100.0@100.0 
Multiplicity 
Ordered?
Unique?
Sequence?
Stereotype 
Visibilitypublic 
Scopeclass 
Access 
Derived?
Constraints 
DocumentationPosition stores the current location of the top left corner of the moving object in the game. 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

-velocity:Point =0.0@2.0: Attribute [UML]

Namevelocity 
Data typePoint 
Default value0.0@2.0 
Multiplicity 
Ordered?
Unique?
Sequence?
Stereotype 
Visibilityprivate 
Scopeinstance 
Access 
Derived?
Constraints 
DocumentationStores the direction and speed of the movement. Positive x values are to the right, positive y values up 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+extent:Point: Attribute [UML]

Nameextent 
Data typePoint 
Default value 
Multiplicity 
Ordered?
Unique?
Sequence?
Stereotype 
Visibilitypublic 
Scopeinstance 
Access 
Derived?
Constraints 
DocumentationMoving objects have width and height 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

-colour:ColorValue: Attribute [UML]

Namecolour 
Data typeColorValue 
Default value 
Multiplicity 
Ordered?
Unique?
Sequence?
Stereotype 
Visibilityprivate 
Scopeinstance 
Access 
Derived?
Constraints 
DocumentationColour of the moving object.  
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+display()void: Operation [UML]

Operation namedisplay 
Parameters 
Return type 
Overridability 
Stereotype 
Visibilitypublic 
Operation typeinstance 
Query?
Preconditions 
Postconditions 
Body 
DocumentationDisplays the object at its current position. The default is to fill its extent with its colour; subclasses can override for more interesting shapes and effects. 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+move(position:Point, direction:int)void: Operation [UML]

Operation namemove 
Parametersin position:Point, in direction:int 
Return type 
Overridability 
Stereotypeaction 
Visibilitypublic 
Operation typeinstance 
Query?
PreconditionsIs not outside the game field, ie. player has not missed the ball. 
Postconditions 
Body 
DocumentationMove changes the location and direction of the moving object in the game field according to the given position and direction.  
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

in position:Point: Parameter

Parameterposition 
Data typePoint 
Directionin 
Default value 
Effect 
Exception?
Stream?
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

in direction:int: Parameter

Parameterdirection 
Data typeint 
Directionin 
Default value 
Effect 
Exception?
Stream?
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+checkHits()void: Operation [UML]

Operation namecheckHits 
Parameters 
Return type 
Overridability 
Stereotype 
Visibilitypublic 
Operation typeinstance 
Query?
Preconditions 
Postconditions 
Body 
DocumentationCheck whether moving object has hit some other object. 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

Paddle: Class [UML]

Class namePaddle 
Attributes+maxSpeed 
Operations+playHitSound()void 
PackageGame 
Abstract?
Active?
Stereotype 
Overridability 
Role 
Parameters 
Constraints 
Invariant 
Derivation rules 
Responsibility 
DocumentationPlayer tries to keep the ball in play by hitting
it with the paddle. 
Simple symbol?
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties

+maxSpeed: Attribute [UML]

NamemaxSpeed 
Data type 
Default value 
Multiplicity 
Ordered?
Unique?
Sequence?
Stereotype 
Visibilitypublic 
Scopeinstance 
Access 
Derived?
Constraints 
DocumentationMaximum speed of the paddle can change during the game 
none
Subgraph typeGraph's name
Decompositionnone
Explosionsnone

Graph properties