类 BoggleBoard
- java.lang.Object
-
- cn.denghanxi.assignment.s53.BoggleBoard
-
public class BoggleBoard extends Object
-
-
构造器概要
构造器 构造器 说明 BoggleBoard()Initializes a random 4-by-4 board, by rolling the Hasbro dice.BoggleBoard(char[][] a)Initializes a board from the given 2d character array, with 'Q' representing the two-letter sequence "Qu".BoggleBoard(int m, int n)Initializes a random m-by-n board, according to the frequency of letters in the English language.BoggleBoard(String filename)Initializes a board from the given filename.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 intcols()Returns the number of columns.chargetLetter(int i, int j)Returns the letter in row i and column j, with 'Q' representing the two-letter sequence "Qu".static voidmain(String[] args)Unit tests the BoggleBoard data type.introws()Returns the number of rows.StringtoString()Returns a string representation of the board, replacing 'Q' with "Qu".
-
-
-
构造器详细资料
-
BoggleBoard
public BoggleBoard()
Initializes a random 4-by-4 board, by rolling the Hasbro dice.
-
BoggleBoard
public BoggleBoard(String filename)
Initializes a board from the given filename.- 参数:
filename- the name of the file containing the Boggle board
-
BoggleBoard
public BoggleBoard(int m, int n)Initializes a random m-by-n board, according to the frequency of letters in the English language.- 参数:
m- the number of rowsn- the number of columns
-
BoggleBoard
public BoggleBoard(char[][] a)
Initializes a board from the given 2d character array, with 'Q' representing the two-letter sequence "Qu".- 参数:
a- the 2d character array
-
-
方法详细资料
-
rows
public int rows()
Returns the number of rows.- 返回:
- number of rows
-
cols
public int cols()
Returns the number of columns.- 返回:
- number of columns
-
getLetter
public char getLetter(int i, int j)Returns the letter in row i and column j, with 'Q' representing the two-letter sequence "Qu".- 参数:
i- the rowj- the column- 返回:
- the letter in row i and column j with 'Q' representing the two-letter sequence "Qu".
-
toString
public String toString()
Returns a string representation of the board, replacing 'Q' with "Qu".
-
main
public static void main(String[] args)
Unit tests the BoggleBoard data type.
-
-