Location

This class defines the concepts of a Location in a coordinate system where the (0,0) position is in the upper left-hand corner. The x-axis extends in a positive direction to the right and the y-axis extends in a positive direction towards the bottom of the screen.

[ Index | Source | Summary | Member Functions ]

Quick Index


Class Summary

class Location
{

public:
Location(int x, int y);
Location();
int Xcoord();
int Ycoord();
void setX(int newX);
void setY(int newY);
int isSameAs (const Location& other) const;
int isInList (const Location* const list, const int listLength) const;
}; // Location

Back to the top of Location


Location(int x, int y);

Construct a Location object with the specified x and y coordinates.

	Location(int x, int y);	

Back to the top of Location


Location();

Construct a Location object at a default location.

        Location();	

Back to the top of Location


int Xcoord();

Return the current x coordinate of the Location object.

     int Xcoord();   

Back to the top of Location


int Ycoord();

Return the current y coordinate of the Location object.

     int Ycoord();  

Back to the top of Location


void setX(int newX);

Change the current Location object by replacing its x coordinate with the specified coordinate value.

     void setX(int newX);        

Back to the top of Location


void setY(int newY);

Change the current Location object by replacing its y coordinate with the specified coordinate value.

     void setY(int newY);        

Back to the top of Location


int isSameAs (const Location& other) const;

Determine if two Location objects refer to the same point. Two Location objects refer to the same point if they have the same values for their x and y coordinates. One Location is the current object and the other Location object is passed as a parameter. This method is declared const because it does not change the current object (i.e., the object performing this method.

     int isSameAs (const Location& other) const;

Back to the top of Location


int isInList (const Location* const list, const int listLength) const;

Determine if the point represented by the current Location object is defined in an array of Locations. The array is represented by a pointer to its first element and an integer defining the length of the array. This method is declared const because it does not change the current object (i.e., the object performing this method.

     int isInList (const Location* const list,
		   const int listLength) const;

Back to the top of Location


Member Functions

public:
int Xcoord();
int Ycoord();
void setX(int newX);
void setY(int newY);
int isSameAs (const Location& other) const;
int isInList (const Location* const list, const int listLength) const;

Back to the top of Location


Generated from source by the Cocoon utilities on Thu Apr 02 12:40:34 1998 .

Report problems to jkotula@unimax.com