All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cs101.canvas.Position

java.lang.Object
   |
   +----cs101.canvas.Position

public class Position
extends Object
Class to represent a point in two dimensional coordinate space


Variable Index

 o x
x coordinate of point
 o y
y coordinate of point

Constructor Index

 o Position()
Constructs a Position with the x and y coordinates equal to zero
 o Position(int, int)
Constructs a Position with the passed coordinates

Method Index

 o copyPosition(Position)
Copyies the passed Position to the current Position
 o setPosition(int, int)
Sets the Position to a new x and y coordinate
 o toString()
Formats the Position to output a string in
the form (x,y)

Variables

 o x
 public int x
x coordinate of point

 o y
 public int y
y coordinate of point

Constructors

 o Position
 public Position()
Constructs a Position with the x and y coordinates equal to zero

Returns:
none
 o Position
 public Position(int x,
                 int y)
Constructs a Position with the passed coordinates

Parameters:
x - x coordinate of point
y - y coordinate of point
Returns:
none

Methods

 o setPosition
 public synchronized void setPosition(int x,
                                      int y)
Sets the Position to a new x and y coordinate

Parameters:
x - new x coordinate
y - new y coordinate
Returns:
none
 o copyPosition
 public synchronized void copyPosition(Position point)
Copyies the passed Position to the current Position

Parameters:
point - Position of point to be copied from
Returns:
none
 o toString
 public String toString()
Formats the Position to output a string in
the form (x,y)

Returns:
string format
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index