vooga.gameEngine.core
Class Position

java.lang.Object
  extended by java.awt.geom.Point2D
      extended by vooga.gameEngine.core.Position
All Implemented Interfaces:
java.lang.Cloneable

public class Position
extends java.awt.geom.Point2D

Wrapper class for representing a 2D Position in space.

Author:
Justin C. Klaassen, Scott D. Brothers

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Point2D
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float
 
Constructor Summary
Position()
          Default constructor; creates a new Position at x = 0 and y = 0.
Position(double x, double y)
          Creates a new Position given an x and y location.
Position(java.awt.geom.Point2D point)
          Creates a new Position given a point in space.
 
Method Summary
 java.lang.Object clone()
           
 int getIntX()
          Returns the X coordinate of this Position in integer precision.
 int getIntY()
          Returns the Y coordinate of this Position in integer precision.
 double getX()
           
 double getY()
           
 void move(double dx, double dy)
          Moves this position dx in the X direction and dy in the Y direction.
 void setLocation(double x, double y)
           
 void setX(double x)
          Changes the x location of the current Position.
 void setY(double y)
          Changes the y location of the current Position.
 
Methods inherited from class java.awt.geom.Point2D
distance, distance, distance, distanceSq, distanceSq, distanceSq, equals, hashCode, setLocation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Position

public Position()
Default constructor; creates a new Position at x = 0 and y = 0.


Position

public Position(double x,
                double y)
Creates a new Position given an x and y location.

Parameters:
x - location
y - location

Position

public Position(java.awt.geom.Point2D point)
Creates a new Position given a point in space.

Parameters:
point - in space
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.awt.geom.Point2D

setX

public void setX(double x)
Changes the x location of the current Position.

Parameters:
x - location

setY

public void setY(double y)
Changes the y location of the current Position.

Parameters:
y - location

getX

public double getX()
Specified by:
getX in class java.awt.geom.Point2D

getY

public double getY()
Specified by:
getY in class java.awt.geom.Point2D

getIntX

public int getIntX()
Returns the X coordinate of this Position in integer precision.

Returns:
the X coordinate

getIntY

public int getIntY()
Returns the Y coordinate of this Position in integer precision.

Returns:
the Y coordinate

move

public void move(double dx,
                 double dy)
Moves this position dx in the X direction and dy in the Y direction.

Parameters:
dx - amount to move in X
dy - amount to move in Y

setLocation

public void setLocation(double x,
                        double y)
Specified by:
setLocation in class java.awt.geom.Point2D