Class Loc
java.lang.Object
nz.ac.vuw.ecs.swen225.gp6.domain.Utility.Loc
location for maze tiles, index 0 to max - 1.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckInBound(Loc l, Maze m) Checks wether a location is in bound of a given maze.booleanif x and y coordinates of this location is equal to a given object that is also a location, return true, else false.inthashCode()intx()returns the x co ordinate.voidx(int x) set the x co ordinate of location.inty()returns the y co ordinate.voidy(int y) set the y co ordinate of location.
-
Constructor Details
-
Loc
public Loc(int x, int y) constructs a new loc object.- Parameters:
x- co ordinate 0 to max - 1y- co ordinate 0 to max - 1- Throws:
IllegalArgumentException- when either co ordinate argument is < 0
-
-
Method Details
-
checkInBound
Checks wether a location is in bound of a given maze.- Parameters:
l- maze to checkm- maze to check- Returns:
- true if a given location is in bounds, else false.
-
x
public int x()returns the x co ordinate.- Returns:
- x co ordinate of location
-
y
public int y()returns the y co ordinate.- Returns:
- y co ordinate of location.
-
x
public void x(int x) set the x co ordinate of location.- Parameters:
x- co ordinate- Throws:
IllegalArgumentException- when co ordinate argument is < 0
-
y
public void y(int y) set the y co ordinate of location.- Parameters:
y- co ordinate- Throws:
IllegalArgumentException- when co ordinate argument is < 0
-
equals
if x and y coordinates of this location is equal to a given object that is also a location, return true, else false. -
hashCode
public int hashCode()
-