Guest User

Untitled

a guest
Jul 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public class Landmark
  2. {
  3. private int m_iX; // x coordinate.
  4. private int m_iY; // y coordinate.
  5. private String m_strName; // Landmark name.
  6.  
  7. /**
  8. * Constructor.
  9. * @param iX X coordinate
  10. * @param iY Y coordinate
  11. * @param strName Landmark name
  12. */
  13. public Landmark(int iX, int iY, String strName)
  14. {
  15. m_iX = iX;
  16. m_iY = iY;
  17. m_strName = strName;
  18. }
  19.  
  20. /**
  21. * Return the x coordinate of this landmark.
  22. * @return x coordinate.
  23. */
  24. public int getX()
  25. {
  26. return m_iX;
  27. }
  28.  
  29. /**
  30. * Returns the y coordinate of this landmark.
  31. * @return y coordinate.
  32. */
  33. public int getY()
  34. {
  35. return m_iY;
  36. }
  37.  
  38. /**
  39. * Returns the landmark name.
  40. * @return Landmark name.
  41. */
  42. public String getName()
  43. {
  44. return m_strName;
  45. }
  46.  
  47. /**
  48. * Does this landmark live on the supplied coordinate?
  49. * @param x X coordinate.
  50. * @param y Y coordinate.
  51. * @return
  52. */
  53. public boolean Intersects(int x, int y)
  54. {
  55. return (x == m_iX && y == m_iY);
  56. }
  57. }
Add Comment
Please, Sign In to add comment