Package itumulator.world
Class Location
java.lang.Object
itumulator.world.Location
Provides an abstraction to deal with coordinates (x,y) and compare them.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAllows comparison of two locations according to their x,y coordinatesintgetX()Gets the x coordinate of the locationintgetY()Gets the y coordinate of the locationinthashCode()Provides a hash value of the location based on their x,y coordinates (assuming no larger coordinates than 1000).toString()Provides the location in a string format of (x, y).
-
Constructor Details
-
Location
public Location(int x, int y) Creates a new location- Parameters:
x- coordinatey- coordinate
-
-
Method Details
-
getX
public int getX()Gets the x coordinate of the location- Returns:
- the x coordinate (int)
-
getY
public int getY()Gets the y coordinate of the location- Returns:
- the y coordinate (int)
-
toString
Provides the location in a string format of (x, y). -
equals
Allows comparison of two locations according to their x,y coordinates -
hashCode
public int hashCode()Provides a hash value of the location based on their x,y coordinates (assuming no larger coordinates than 1000).
-