java.lang.Object
nz.ac.vuw.ecs.swen225.gp6.domain.Utility.Loc

public class Loc extends Object
location for maze tiles, index 0 to max - 1.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Loc(int x, int y)
    constructs a new loc object.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Checks wether a location is in bound of a given maze.
    boolean
    if x and y coordinates of this location is equal to a given object that is also a location, return true, else false.
    int
     
    int
    x()
    returns the x co ordinate.
    void
    x(int x)
    set the x co ordinate of location.
    int
    y()
    returns the y co ordinate.
    void
    y(int y)
    set the y co ordinate of location.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Loc

      public Loc(int x, int y)
      constructs a new loc object.
      Parameters:
      x - co ordinate 0 to max - 1
      y - co ordinate 0 to max - 1
      Throws:
      IllegalArgumentException - when either co ordinate argument is < 0
  • Method Details

    • checkInBound

      public static boolean checkInBound(Loc l, Maze m)
      Checks wether a location is in bound of a given maze.
      Parameters:
      l - maze to check
      m - 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

      public boolean equals(Object o)
      if x and y coordinates of this location is equal to a given object that is also a location, return true, else false.
      Overrides:
      equals in class Object
      Parameters:
      o - object to compare to.
      Returns:
      true if o is a location and shares same x and y values as this location
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object