cgorrillaha

Location

Mar 26th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. package model;
  2.  
  3. public class Location {
  4.     private int row;
  5.     private int col;
  6.  
  7.     public Location(int r, int c){
  8.         row=r;
  9.         col=c;
  10.     }
  11.  
  12.     public boolean equals(Location loc){
  13.         boolean sameRow=this.row==loc.getRow();
  14.         boolean sameCol=this.col==loc.getCol();
  15.         return sameCol&&sameRow;
  16.     }
  17.  
  18.     public int getRow(){
  19.         return row;
  20.     }
  21.  
  22.     public void setRow(int r){
  23.         row=r;
  24.     }
  25.  
  26.     public int getCol() {
  27.         return col;
  28.     }
  29.  
  30.     public void setCol(int c) {
  31.         col = c;
  32.     }
  33.  
  34.     @Override
  35.     public String toString(){
  36.         return "[ROW: "+row+" COL: "+col+"]";
  37.     }
  38.  
  39.  
  40. }
Add Comment
Please, Sign In to add comment