location.java

来自「proxy server for caching and packet filt」· Java 代码 · 共 50 行

JAVA
50
字号
/**
 * Represents the holes on the 10 x 10 board
 */
public class Location{                      //the holes on the 10 X 10 square : row, column coordinates
  /**
   * The row coordinate
   */
  private int row;
  /**
   * The column coordinate
   */
  private int col;
  /**
   * Creates an object with specified row and column coordinates
   * @param r row
   * @param c column
   */
  Location(int r, int c){            //constructor takes the coordinates
    row=r;
    col=c;
  }
  /**
   * Default constructor
   */
  Location(){
    row=0;
    col=0;
  }
  /**
   * @return the row coordinate
   */
  public int row(){
    return row;
  }
  /**
   * @return the column coordinate
   */
  public int col(){
    return col;
  }
  /**
   * Tests if two objects refer to the same hole
   * @param l Location to compare with
   * @return true if this Location and l refer to the same hole
   */
  public boolean equal(Location l){  
    return ((row==l.row())&&(col==l.col()));
  }
};
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?