de.unifreiburg.informatik.tetris.game.block
Class CartPt

java.lang.Object
  extended by de.unifreiburg.informatik.tetris.game.block.CartPt

public class CartPt
extends java.lang.Object


Field Summary
(package private)  int x
           
(package private)  int y
           
 
Constructor Summary
CartPt(int x, int y)
          Creates a new Point with coordinates x and y.
 
Method Summary
 CartPt add(CartPt that)
          Returns a new point that represents the sum of the two points.
 int getX()
          Returns the x coordinate of the point.
 int getY()
          Returns the y coordinate of the point.
 void move(CartPt that)
          Moves the point, so p1.move(p2) does p1.x = p1.x + p2.x and p1.y = p1.y + p2.y.
(package private)  void moveDown(int y)
          Moves the point down by y steps.
 CartPt rotateClockwise(CartPt that)
          Rotates the point (this) clockwise by 90 degrees around the parameter (that).
 CartPt rotateCounterClockwise(CartPt that)
          Rotates the point (this) counter clockwise by 90 degrees around the parameter (that).
 boolean samePos(CartPt that)
          Check if the two points are at the same position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

int x

y

int y
Constructor Detail

CartPt

public CartPt(int x,
              int y)
Creates a new Point with coordinates x and y.

Parameters:
x -
y -
Method Detail

getX

public int getX()
Returns the x coordinate of the point.

Returns:
x

getY

public int getY()
Returns the y coordinate of the point.

Returns:
y

samePos

public boolean samePos(CartPt that)
Check if the two points are at the same position.

Parameters:
that -
Returns:

move

public void move(CartPt that)
Moves the point, so p1.move(p2) does p1.x = p1.x + p2.x and p1.y = p1.y + p2.y.

Parameters:
that -

add

public CartPt add(CartPt that)
Returns a new point that represents the sum of the two points.

Parameters:
that -
Returns:
the sum of the two points.

rotateClockwise

public CartPt rotateClockwise(CartPt that)
Rotates the point (this) clockwise by 90 degrees around the parameter (that).

Parameters:
that - is the center of rotation
Returns:
the target coordinates as a point.

rotateCounterClockwise

public CartPt rotateCounterClockwise(CartPt that)
Rotates the point (this) counter clockwise by 90 degrees around the parameter (that).

Parameters:
that - is the center of rotation
Returns:
the target coordinates as a point.

moveDown

void moveDown(int y)
Moves the point down by y steps.

Parameters:
y -