p_abstractions
Interface PaddleSpecification

All Known Implementing Classes:
Paddle, RunnableViewablePaddle

public interface PaddleSpecification

Specification of simple paddle behaviour for use in a video game.
For teaching MVC design pattern.

Version:
1.0.0
Author:
J Paul Gibson

Field Summary
static boolean INVARIANT_OF_CLASS
           
static int MAXIMUM_position
          The upper bound on the horizontal position of the paddle
static int MINIMUM_position
          The lower bound on the horizontal position of the paddle
 
Method Summary
 void changeDirection()
          Changes direction from left to right, or right to left.
 boolean equals(java.lang.Object thing)
           
 int get_position()
           
 boolean goingRight()
           
 java.lang.String toString()
           
 void updatePosition()
          Update paddle position or direction of movement:
if moving out of defined limits then change the direction of the paddle movement without changing position if moving right inside limits then increment position if moving left inside limits then decrement position
 

Field Detail

MINIMUM_position

static final int MINIMUM_position
The lower bound on the horizontal position of the paddle

See Also:
Constant Field Values

MAXIMUM_position

static final int MAXIMUM_position
The upper bound on the horizontal position of the paddle

See Also:
Constant Field Values

INVARIANT_OF_CLASS

static final boolean INVARIANT_OF_CLASS
See Also:
Constant Field Values
Method Detail

get_position

int get_position()
Returns:
The position of the paddle - must be within the defined limit: MINIMUM_position ... MAXIMUM_position

goingRight

boolean goingRight()
Returns:
true if the paddle is moving to the right and false otherwise

updatePosition

void updatePosition()
Update paddle position or direction of movement:


changeDirection

void changeDirection()
Changes direction from left to right, or right to left.


equals

boolean equals(java.lang.Object thing)
Overrides:
equals in class java.lang.Object
Parameters:
thing - is the input object to test for equality

toString

java.lang.String toString()
Overrides:
toString in class java.lang.Object