graph
Class Location

java.lang.Object
  extended by graph.Location

public class Location
extends java.lang.Object

The location class represents an integer coordinate location. The class has only two members: x and y coordinates. This class is meant to be used with the Graph API but can be used in many situations.

Since:
1.5
Version:
1.0
Author:
Jonah Scheinerman

Field Summary
static Location ORIGIN
          A Location that is a the origin of a plane, (0,0).
 
Constructor Summary
Location()
          Creates a new location at the coordinates (0,0).
Location(int x, int y)
          Creates a new location at the coordinates (x,y).
 
Method Summary
 boolean equals(java.lang.Object obj)
          Determines whether or not the coordinates are the same location and returns true or false accordingly.
 int getX()
          Returns the x coordinate of this location.
 int getY()
          Returns the y coordinate of this location.
 int hashCode()
           
 void setX(int x)
          Sets a new value for the x coordinate of this location.
 void setY(int y)
          Sets a new value for the x coordinate of this location.
 java.lang.String toString()
          Generates an output string of the form: (x,y).
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ORIGIN

public static final Location ORIGIN
A Location that is a the origin of a plane, (0,0).

Constructor Detail

Location

public Location()
Creates a new location at the coordinates (0,0).


Location

public Location(int x,
                int y)
Creates a new location at the coordinates (x,y).

Parameters:
x - - the x coordinate
y - - the y coordinate
Method Detail

getX

public int getX()
Returns the x coordinate of this location.

Returns:
x

setX

public void setX(int x)
Sets a new value for the x coordinate of this location.

Parameters:
x - - the new value

getY

public int getY()
Returns the y coordinate of this location.

Returns:
y

setY

public void setY(int y)
Sets a new value for the x coordinate of this location.

Parameters:
y - - the new value

toString

public java.lang.String toString()
Generates an output string of the form: (x,y).

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Determines whether or not the coordinates are the same location and returns true or false accordingly.

Overrides:
equals in class java.lang.Object
Parameters:
another - location
Returns:
true or false if the objects are equal or not equal, respectively.